Wednesday, May 20, 2009

Making a Bootable Ubuntu USB Flash Drive Using Isostick.sh

If, like me, you're too lazy to find a blank CD every time you want to try a new flavour of Ubuntu, these instructions might be useful. This needs to be done on an Internet-connected Linux machine, follow these steps at your own peril (worked for me):

1. If you haven't done so yet, get your favourite Ubuntu .iso file here

2. Whilst it is downloading, get the isostick.sh script here

3. Install syslinux : $ sudo apt-get install syslinux

4. Observe the output of : $ sudo fdisk -l

5. Pop in your empty >= 1GB USB flash drive and repeat step 4, noting the additional lines to indicate the presence of your flash drive. You want to find its path which will be something like /dev/sdb1 or /dev/sdc1. For the remainder of this example, we will use the unlikely address of /dev/sdz/ and /dev/sdz1 - insert the address relevant to your own system.

CAUTION: be sure - if you're not sure, remove any other external storage devices and try steps 4 and 5 again. If you're still not sure, don't proceed. Save yourself the chilling horror of discovering that you've just nuked something you didn't mean to. Seriously. Be sure.

6. Just to be safe, unmount your flash drive (in the event of the OS having mounted it automatically) : $ sudo umount /dev/sdz1

7. Now we need to partition your flash drive (note that we're referring to the drive itself here, not an individual partition, so we omit the 1 from the end of the path) : $ fdisk /dev/sdz

8. Enter p to list existing partitions on the drive, enter d to delete them (follow the prompts), enter n to create a new partition (follow the prompts), enter t and set the type to 6, enter a followed by 1 to make your new partition bootable, enter w to write the changes and your flash drive should now be partitioned with a FAT16 partition, ready for formatting

8. Enter : $ sudo mkfs.msdos /dev/sdz1

9. To save some hassles, copy your Ubuntu .iso and the isostick.sh script to the same folder and cd to it in your command line. Alternately enter the full paths in the following command.

10. To actually write the image to the disk using isostick (no need to be alarmed by the error messages) : $ sudo isostick.sh ubuntu-9.04-desktop-i386.iso /dev/sdz1

11. See if it boots - remember that not all PC's will automatically boot from a USB device - you might need to set your boot order in your BIOS when the PC is starting up, or look for an instruction to press a certain key to access the boot menu / boot options during startup (before the OS starts loading).

Credits and links:

Thanks to ricey for his useful page over here, which put me onto the isostick.sh script

Additional information from our Ubuntu friends on USB booting

One source for the elusive isostick.sh script

1 comment:

rax said...

Linux flash drive can provide a communication channel that is safe from a possibly compromised computer. linux flash drive