Monday, 16 July 2012

Formatting a USB stick for UNETBOOTIN

I spent ages trying to create a bootable USB stick with UNETBOOTIN for BackTrack.  Turns out that the trick is to format the USB stick correctly before you start...

As far as I can tell, the USB stick needs to be partitioned with a single primary FAT32 partition.  I was unable to get this to work under Mac OS X (possibly due to Finder's habit of dropping hidden files everywhere) or under Windows.   But I did get it working on Ubuntu Linux, as follows.

First become root using sudo -s

Now make sure you know the device name of your USB stick.   Best to start a command like tail -f /var/log/messages then insert the USB stick and watch for the messages.  You want to know the underlying physical device name e.g. /dev/sdc (this might apply if you have a hard drive and a CDROM).  Then umount the device before continuing...  

Now, start by deleting any partition on the stick.  Of course you MUST make sure you don't specify the wrong device name, or you may delete your hard disk contents!   The command I use is dd if=/dev/zero of=/dev/sdc bs=1M count=10 to simply dump a load of zeroes over the first 10 megabytes of the raw device.   Just be sure whether /dev/sdc is correct on your system before you proceed!

Now partition the raw device.  

fdisk /dev/sdc
    n   (create a new partition)
    p   (primary partition)
          1  (partition number)
              (Accept defaults for start and end)
    t   (change partition type [system id])
        b   (select WIN 95 FAT32)
   w   (write changes back to the stick, and exit)

Now format the partition you just created, for example sdc1.

mkfs.vfat /dev/sdc1

Now the device is ready for use with UNETBOOTIN.

3 comments:

  1. Nice tutorial, Worked perfectly but just wanted to add in my case after I did the mkfs.vfat /dev/sdX The thumb drive wouldn't automount, but it was easy enough to get around as root: mount /dev/sdx /mnt where x=the drive letter.

    ReplyDelete
  2. Thanks for the information. This was my fdisk session:

    fdisk /dev/sdc
    n (create a new partition)
    p (primary partition)
    1 (partition number)
    (Accept defaults for start and end)
    t (change partition type [system id])
    1 (partition number)
    b (select WIN 95 FAT32)
    w (write changes back to the stick, and exit)

    Look that I was asked to enter partition number after "t", to change partition type, and it must be entered (no defaults).

    Josep

    ReplyDelete
  3. wish i would have read this before spending an hour trying to figure why my usb would not boot.

    ReplyDelete

Spammers: please stop wasting my time. All comments are moderated before publication.