Disclaimer:
I am sure that there are plenty of how-to pages available for these tasks, and I am sure that you may be able to google yourself up one that you like better than this one.  The point of the following entry is to show "a" way to format a usb drive and transfer a LiveOS ISO to it using the command line in linux. It was done using Fedora 8, but will probably work with most other distros.  If you try it and it works, I am happy for you.  If you try it and it doesn't, I am sorry.  You are welcome to leave comments, questions, problems reports, rants, etc.  I will try to respond to them when I get the chance.

Enjoy,

-Curt


Transferring a Live/Bootable OS to a usb flash drive

Once you are done, the drive should have the LiveOS on it, it should be bootable, and it should also be usable as a regular USB storage device for most operating systems (windows, linux, macos, etc.)

  1. Plug in usb drive
  2. If you're doing this in a vmware virtual machine, then select vm->Removable Devices->Removable Disk
  3. Become root ( su )
  4. Type dmesg to see which device label the usb drive received. It should show up as the next scsi device. (If you have one scsi disk as your / linux volume, then the next scsi device will be /dev/sdb)
  5. Run fdisk on the usb device
  6. Delete any partitions shown (This will delete all data that may exist the drive)
  7. Create a new partition using all space on the device
  8. Mark the new partition as bootable
  9. Write the new partition table information to the usb flash drive
  10. Unplug the device
  11. Plug the device back in
  12. Check dmesg to see that it has been recognized (should see device and partition. Ex: /dev/sdb1 )
  13. Create a fat32 file system on the device
  14. Transfer your LiveOS ISO to the device

Command Line Step-by-step

  • Become Root

$ su
password:

  • Find the device name of the usb flash drive. It should show up as the last device in dmesg

# dmesg
.
.
.
scsi 5:0:0:0: Direct-Access     Ut165    USB2FlashStorage 0.00 PQ: 0 ANSI: 2
sd 5:0:0:0: [sdd] 3948544 512-byte hardware sectors (2022 MB)
sd 5:0:0:0: [sdd] Write Protect is off
sd 5:0:0:0: [sdd] Mode Sense: 00 00 00 00
sd 5:0:0:0: [sdd] Assuming drive cache: write through
sd 5:0:0:0: [sdd] 3948544 512-byte hardware sectors (2022 MB)
sd 5:0:0:0: [sdd] Write Protect is off
sd 5:0:0:0: [sdd] Mode Sense: 00 00 00 00
sd 5:0:0:0: [sdd] Assuming drive cache: write through
 sdd: unknown partition table
sd 5:0:0:0: [sdd] Attached SCSI removable disk
sd 5:0:0:0: Attached scsi generic sg4 type 0

  • Run fdisk to remoce existing partitions (and any data)

# fdisk /dev/sdd

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Selected partition 4

  • Create new partition using all available space

Command (m for help): n
Command action 
   e   extended 
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1010, default 1): <enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1010, default 1010): <enter>
Using default value 1010

  • Make new partition bootable

Command (m for help): a
Partition number (1-4): 1

  • Write new partition information to usb disk

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

  • Unplug usb device
  • Plug usb device back in
  • Check to see that it is recognized (in the following example, the flash drive is recognized as the 4th scsi device (sdd) with 1 partition (/dev/sdd1)

dmesg
scsi 7:0:0:0: Direct-Access     Ut165    USB2FlashStorage 0.00 PQ: 0 ANSI: 2
sd 7:0:0:0: [sdd] 3948544 512-byte hardware sectors (2022 MB)
sd 7:0:0:0: [sdd] Write Protect is off
sd 7:0:0:0: [sdd] Mode Sense: 00 00 00 00
sd 7:0:0:0: [sdd] Assuming drive cache: write through
sd 7:0:0:0: [sdd] 3948544 512-byte hardware sectors (2022 MB)
sd 7:0:0:0: [sdd] Write Protect is off
sd 7:0:0:0: [sdd] Mode Sense: 00 00 00 00
sd 7:0:0:0: [sdd] Assuming drive cache: write through 
 sdd: sdd1
sd 7:0:0:0: [sdd] Attached SCSI removable disk
sd 7:0:0:0: Attached scsi generic sg4 type 0

  • Create FAT32 file system on usb device

# mkdosfs -F 32 /dev/sdd1
mkdosfs 2.11 (12 Mar 2005)

  • Transfer a boot ISO to a usb flash drive
  • The needed scripts are found in the "livecd-tools" package. You can use yum to download and install the package (ex: "yum install livecd-tools").
  • Copying a 700MB ISO to a flash drive takes about 4-5 minutes from a fedora vm on my dell laptop

# livecd-iso-to-disk ./qcllc_webclass_fc8.iso /dev/sdd1
Verifying image...
./qcllc_webclass_fc8.iso:   6c2ed7f09f56942bd37e8ba77fc10bb1
Fragment sums: 2f39bb733392615768632e67a8ed59255ccb19d1e42ab989a86cbd927d3f
Fragment count: 20
Percent complete: 100.0%   Fragment[20/20] -> OK
100.0
The media check is complete, the result is: PASS.

It is OK to use this media.
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!
#

  • USB should now have the LiveOS on it and should be bootable.