Sunday, July 26, 2009

Bootable BackTrack 3 USB drive that allows Persistent Changes: article 200914



Take Aways: Using at least a 2 Gig USB stick create 2 partitions one for the BT3 OS the other to write files too.

Tools I used: 2 GB USB stick, Unebootin for Windows, a Desktop running XP and a laptop running a LIVE CD of BackTrack3

First giving credit where it is due: wirelessdefence.org Which is where I pulled my info on how to partition the USB stick and set it for persistent changes.

http://wirelessdefence.org/Contents/Backtrack3_USB_Howto.htm

There are several ways to do this and I am sure mine it not the most elegant but it worked for me.

I booted my Dell Inspiron 5150 with a live CD of BT3, inserted the USB stick and followed wirelessdefence's instructions for creating the partitions:
<>


1. Boot up your Linux machine (this is only required for initial installation a VMware machine will work fine).

2. In the Linux machine run "tail -f /var/log/messages" and insert the USB drive. In my case the following is displayed "[sdb] Attached SCSI removable disk" so we now know the USB device is sdb.

3. fdisk /dev/sdb

4. Command (m for help): p (to see what is on the drive).

5. If there are any existing partitions on the device delete them using d you will then be prompted for the partition number.

6. Command (m for help): n (to create a new partition)

7. Command action e extended, p primary partition (1-4): p (for primary)

8. Partition number (1-4): 1 (for first partition)

9. First cylinder (1-245, default 1): 1 or Enter (to start at the first cylinder)

10. Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): +1024M (to create a 1Gb partition)

11. Command (m for help): t (to set partition type)

12. Hex code (type L to list codes): b

13. Command (m for help): n (to create a new partition)

14. Command action e extended, p primary partition (1-4): p (for primary)

15. Partition number (1-4): 2 (for the second partition)

16. First cylinder (126-245, default 126): Enter (to accept default)

17. Last cylinder or +size or +sizeM or +sizeK (126-245, default 245): Enter (to use the rest of the disk this will create a 1Gb partition if you're using a 1Gb disk)

18. Command (m for help): t (to set partition type)

19. Partition number (1-4): 2

20. Hex code (type L to list codes): 83

21. Command (m for help): p (to make sure there are two partitions of the type and size you are expecting)

22. Command (m for help): w (to write you changed to the disk, without this step nothing is actioned).


Mounting the new partitions in Linux:

1. Create 2 mount points e.g. mkdir /usb and mkdir /usb1

2. mount /dev/sdb1 /usb (mount the FAT partition). You made need to specify the file system e.g. mount -t vfat /dev/sdb1 /usb

3. mount /dev/sdb2 /usb1 (mount the Linux partition). You made need to specify the file system e.g. mount -t ext3 /dev/sdb2 /usb1

Note: If you are having trouble mounting any particular drive do a format on the windows partition or an fsck on the Linux partition prior to performing the mount.

< >

I don't know why but I did have trouble mounting my sda2 device and none of the suggestions above worked for me so I ran "mke2fs /dev/sda2" to format the partition and that did the trick.

Now that I had my 2 partitions I shutdown the my BT3 OS (this just worked best for me with adding and removing the USB stick) and pulled my USB stick out and placed it into my XP machine.

Now here is a jewel for making the USB stick bootable: UNetbootin from SourceForge. This app will automatically create a bootable USB drive for you with about 50 different OS types plus many over their versions! Of course BackTrack 3 is one of the options.


If you do not already have the ISO image downloaded it will go an snag it for you. In my case I had downloaded locally already so I clicked DiskImage and pointed it to my file.

In a manner of about 5 minutes I was ready to go.

I once again booted my laptop to the BT3, inserted the USB stick and once again looked to Wirelessdefence.com for assistance.

< >

1. mkdir /usb1/changes (manually create a "changes" folder on the Linux partition)

2. vi /usb/boot/syslinux.cfg (or use another text editor to open the file)

3. At the end of the APPEND line, under the mode you are planning to use e.g. KDE, add the following:

changes=/dev/sdb2

So, for the MENU LABEL BT3 Graphics mode (KDE)

"......rw autoexec=xconf;kdm" becomes "......rw autoexec=xconf;kdm changes=/dev/sdb2"

After you have made the changes save the file.

< >

I then rebooted the laptop choosing this time to boot to the USB key and "Boom, goes the dynamite"

The writable partition, for me, was under /mnt/sda2

.


No comments:

Post a Comment