Most modern computers allow booting from a USB thumb drive. However, creating a bootable USB drive can be a tricky task because different BIOS may assign different hexadecimal designators for a USB drive, depending on computers and situations. For example, my laptop assigns 0x80 to the internal hard drive and 0x81 to a USB drive when the computer boots from the internal hard drive as usual. However, if I choose to boot from my USB thumb drive at the BIOS boot menu after pressing Esc, the BIOS assigns 0x80 to the USB drive and 0x81 to the hard drive.
Booting from external storage, such as a USB drive or SDHC card, allows one to start an operating system externally, freeing oneself from the limitations of an internel hard drive. In this post, I show heterogenous methods to create a bootable USB drive.
Partitioning a USB drive
Most USB thumb drives have only one partition. If you are happy with just one partition, that's fine. But if you want to slice your USB drive into multiple partitions, I recommend you to use GParted. To download and use GParted, get a bootable ISO from the following links and burn it with CD burning software, such as CDBurnerXP.
I partition my USB drive in order to install Linux on it. Usually, I make 2 partitions (one FAT16 partition and one EXT2 partition). Sometimes, I create another partition that I format as Linux swap. Here's my typical partition layout for USB thumb drives.
/dev/sdb1 | FAT16 or FAT32 |
/dev/sdb2 | EXT2, EXT3 or JFS |
/dev/sdb3 | Linux Swap |
Installing MBR
Setting up MBR (short for master boot record) correctly is crucial in creating a bootable USB drive. In this post, I use the Debian/Ubuntu mbr package to set up MBR on my USB thumb drive.
Use the install-mbr
command from the mbr package to install a functional master boot record.
install-mbr /dev/sdc -v --drive 0x80 --enable +12
Making FAT partitions bootable
FreeDOS kernel and FreeCOM
Originally, my 256MB USB thumb drive has only one primary partition formatted in FAT16. Since it's not feasible to install Windows on USB thumb drives, I installed a FreeDOS kernel on my USB thumb drive. I downloaded FreeDOS kernel and FreeCom command shell. I booted FreeDOS using a FreeDOS floppy. Then, I installed kernel.sys and command.com just to have a bootable DOS.
sys D /update /oem:fd
copy command.com D:
Restart your computer with the USB thumb drive still plugged in. Press the key for displaying the BIOS boot menu. This key may be Esc or F12. Select your USB drive from the menu. Hopefully, you'll reach the FreeDOS command prompt.
Syslinux
Syslinux can be installed on either FAT or EXT2 partition. Syslinux provides a versatile multi-boot functionality, comparable to GRUB. In Linux, I used the following command to make the FAT partition bootable with syslinux.
syslinux /dev/sdb1
This command copies ldlinux.sys to the FAT partition.
No comments:
Post a Comment