Tuesday, January 8, 2008

Creating ext2 partition to save changes

Okay, we have the Fat32 partition set up on the USB Flash Drive. We installed BT3 onto it and made it bootable. Now we have to make the linux ext2 partition to save the changes to.

I loaded BackTrack using the USB drive. Here's where you'll learn from my mistakes. I couldn't create partitions on the drive while it was in use for BackTrack. Don't make the same mistake. Load Backtrack from the CD we created a few posts back. Once the KDE menu from BackTrack starts up, plug in the USB drive so that it will be recognized. Let BackTrack load from the disk. Yeah, I know, it's slow.

Once BackTrack starts, we'll need to determine what our USB drive is known as. Click on the home icon in the top left corner. It will open in the root folder. Click the green "UP" arrow, and then double click the folder named 'mnt'. (This stands for mount, or the drives that are mounted). Look for the USB drive, it should start with the letters 'sd'. Mine is sdb1', which means the first partition on 'sdb'. Open the folder to make sure it's the right one. It should contain the 'BT3' and 'boot' folders.

Now we'll create a second partition. I will write the instructions using 'sdb1' and 'sdb2'. You substitute it with your name, such as 'sda1' or 'sdc1'.

Open a Konsole Shell by clicking the second icon on the bottom of the screen. It is a picture of a black monitor.

First we will unmount the drive, so that we can partition it further. At the prompt "bt - #" type:

umount /dev/sdb1 (umount, not unmount)

Type: fdisk /dev/sdb - to start the fdisk program

At the "Command (m for help):" prompt

Type : p -this shows you the current partitions. You should see only one partition - /dev/sdb1

Type : n -for new partition

Type : p -for primary partition

Type : 2 -to make it the second partition

Press Enter -to choose first available cylinder to start partition

Press Enter -to choose last available cylinder to end partition

At the "Command (m for help):" prompt

Type : t -to select type of partition

Type : 2 -to select second partition

Type : 83 -this selects a linux partition

At the "Command (m for help):" prompt

Type : p -this will show you the current setup. You should see your to partitions, one W95 FAT32 and one Linux

Type : w -this will write the setup to your drive and make it official. Congratulations!!

Now we have to format the partition to an ext2 partition. At the "Command (m for help):" prompt,

Type : mkfs.ext2 /dev/sdb2



You should be done now!!!

Restart the computer by clicking on bottom leftmost icon (which is like the Windows Start button), select 'log out..', and click on 'Restart Computer'.

Log in again using the first menu item on the boot menu.

Once you're logged in, go to the /mnt folder again using the Home icon. You should now see a new folder called 'sdb2' (or sdc2, sda2, etc.). That's the new partition we just finished making. Double click on it. (You may see a folder in there called 'lost+found', disregard it). Right click on the inside of the folder, and choose 'Create new' -->'folder'. Name it 'changes' and click OK. (Not 'Changes with a capital 'C', as noted by jcmgarvey in his comment.) That will be the folder that will hold all the changes.

One more step and we're done for now. Click on the "Green" arrow on top of the folder to go up one level, and open the sdb1 folder, then the 'boot' folder, and then the 'syslinux' folder.

Double click on the file named 'syslinux.cfg'. This is the configuration file for the startup menu when we log in. Find the group of lines that begins with 'LABEL pchanges'. Then under that find the line beginning with 'APPEND'. We're going to edit that line. Right now the line reads

APPEND vga=0x317 initrd=.......

You change it by adding this - changes=/dev/sdb2

Now the line should read:

APPEND vga=0x317 changes=/dev/sdb2 initrd=.....

Here's a picture of before and after:




Save and close the file.

Restart your computer and on the startup menu, select the third item down the list, Graphics mode with Persistent Changes. You are good to go. The changes are being saved. We're ready to roll.

Please beware that if you shut your computer by pressing the off button, your changes files will become corrupt and you will have to erase them and start fresh. Make sure to go through the shut down process each time.

Good bye for now. Next we will tweak the startup a little bit to make it run a bit easier and some.

5 comments:

pj said...

Great site so far, keep up the useful information, and easy to follow instructions.

I noticed one issue myself, after adding the 'Changes' folder and booting with persistent changes I would get the error "mounting aufs on union failed". There is some info on this out there re: it being an issue with a bad .iso image.

I thought maybe permissions on the folder or ext2 partition, so I upped them, but then when I changed the name of the folder from 'Changes' (capital C to 'changes', it has worked fine, boots up fine multiple times and saves the changes.

I had some fun playing with BT2 last year, but found so many things not working correctly for me, that I eventually had to give up trying. Hopefull BT3 will work better.

PJ

Miss Take said...

Thank you for the compliment. Glad you like it.
Thank you even more for correcting me. You are right. The folder must be 'changes' not 'Changes'. I once had the same issue and changing it helped. I have uodated the blog post with that info. Thanks again.

Unknown said...

Very nice nice writeup, everything works! Up until I make the file system for ext2. After it completes I have no "sda2" in my case. The newly created partition and filesystem show up in fdisk but not under /mnt/sda2.
Please advise...

Jim Hubbard said...

same problem as Mark...no sda2

fdisk | p shows the partition as /dev/sda2 and that it is Linux and 83...but it does not show in /mnt

wassup?

Suhail Sheth said...

when i try to add 2nd partition
it says :

Partition number (1-4): 2
No free sectors available

please can u help
thanks great site!!!!!!!!!