Life, Code & Idiocy

Bloggage of a web coding nutcase

28 Jul 2009

Howto: BackTrack 3 + USB + Persistence without re-partitioning

I can never seem to understand why BackTrack 3 was flamed so bad for having bad USB support. I’d like to think it has great USB support – especially because it uses aufs instead of casper, meaning you have a ton of options that, if you play your cards right, do not require repartitioning. I couldn’t find any guides for this anywhere so I decided to share my newfound knowledge with the world here.

NOTE: This guide works on BT3, not BT4. BT4 uses Casper, which means I can’t use it on my USB hard disk (I already have Ubuntu installed.)

In my case, this involved a couple of extra steps. First you want to make sure BT3 is installed on your USB device and booting properly; don’t worry about making two partitions, just make one that is FAT32. For the record, I decided to go with FAT32 for my drive because it works with literally any operating system out there, and because all live Linux distributions can boot from it.

Boot BT3 and identify which drive is yours; for me, this was sdb1. Create your changes file:

cd /mnt/sdb1/BT3
dd if=/dev/zero of=changes.img bs=8M count=128

Note that I used a 8×128 = 1024MB image file here. That’s big (I’m on a 320GB hard disk here) and you might not have that kind of space. Adjust the “count” parameter accordingly. Now format the image:

mkfs.ext3 -F changes.img
tune2fs -c 0 -i 0 changes.img

Finally you need to mount it and create the “changes” directory on it. This is the non-obvious step that causes aufs to fail if it’s omitted; it took a fair amount of reverse engineering for me to actually figure this out.

mkdir mnt
mount -t ext3 -o loop changes.img mnt
mkdir -p mnt/changes
umount mnt
rm -rf mnt

The last step is to edit your GRUB or SYSLINUX configuration file and add “changes=BT3/changes.img” to the end of each “append” line (for SYSLINUX) or “kernel” line (for GRUB). There you should have it – a fully writeable BackTrack 3 installation on your USB device, without having to reformat. Of course, you’ll want to reboot to test your changes.

This drive has presented a fun side project for me: cram as many OSes onto one disk as possible. It’s going quite well so far: I have successfully installed Fedora 11, Ubuntu 9.04 (live only), Knoppix 5.3, Arch 2009.1, and BackTrack 3 all on the same partition (with some Fedora files on an ext3 partition to let me use a huge 8GB overlay). These parallel installations can be tricky because you have to do all of them manually, but they are a cool challenge – especially when you can plug a drive into any random computer and see a menu letting you choose from 5 OSes. :D

Posted in Uncategorized

No Responses to “Howto: BackTrack 3 + USB + Persistence without re-partitioning” (post new)

 

Leave a Reply