Booting from USB
When people give instructions for creating a bootable USB stick, they always tell you to use FAT-16 or FAT-32 (MS-DOS/Windows) filesystem and tools such as Unetbootin and Syslinux for creating the bootable USB stick. Besides not liking to use a Windows filesystem for Linux, I ran into trouble with UNetBootIn not being able to identify my USB stick (maybe I have too many LVM2 partitions, who knows?). I gave up trying to fix it, intending to find instructions for syslinux, and instead found one fellow (see references below) who advocated the use of EXT2 and GRUB. I felt silly for not having tried this before – it's so sensible and easy.
These instructions are for people like me who use Linux, not Windows, and the old version of GRUB (e.g., version 0.97, a.k.a. GRUB Legacy) rather than the new one (version 1.x). I find the old version of GRUB very easy to configure, but not the new one. If you are using the newer 1.x version of GRUB then these instructions are not for you.
Format for ext2
The first step is to prepare the partition using the EXT2 filesystem. So here is what I do:
- Insert the USB stick
- Check which device it has been assigned to, e.g.:
dmesg | tail [103147.757292] sd 25:0:0:0: [sdb] Write Protect is off [103147.757296] sd 25:0:0:0: [sdb] Mode Sense: 43 00 00 00 [103147.758153] sd 25:0:0:0: [sdb] No Caching mode page present [103147.758157] sd 25:0:0:0: [sdb] Assuming drive cache: write through [103147.762009] sd 25:0:0:0: [sdb] No Caching mode page present [103147.762013] sd 25:0:0:0: [sdb] Assuming drive cache: write through [103147.762881] sdb: sdb1 sdb2 [103147.765521] sd 25:0:0:0: [sdb] No Caching mode page present [103147.765524] sd 25:0:0:0: [sdb] Assuming drive cache: write through [103147.765527] sd 25:0:0:0: [sdb] Attached SCSI removable disk
- Create the filesystem, e.g.:
mkfs -t ext2 -L linux /dev/sdb1
Place Linux ISO on the USB stick
- Mount the ISO image, e.g.:
sudo mkdir /mnt/iso sudo mount Sabayon_Linux_7_amd64_Xfce.iso /mnt/iso
- Mount the USB stick, e.g.:
sudo mkdir /mnt/usbstick sudo mount /dev/sdb1 /mnt/usbstick
- Copy the files:
cp -prv /mnt/iso/* /mnt/usbstick/
Place GRUB on the USB stick
- Copy your existing GRUB configuration files from your computer:
cp -av /boot/grub /mnt/usbstick/boot/
- Edit /mnt/usbstick/boot/grub/grub.conf as required
- For Sabayon1) this works for me:
default=0 timeout=15 title Sabayon Linux root (hd0,0) kernel /boot/sabayon root=/dev/ram0 aufs init=/linuxrc cdroot=/dev/sdb1 \ looptype=squashfs max_loop=64 loop=/livecd.squashfs vga=0x318 \ CONSOLE=/dev/tty1 verbose scandelay -- initrd /boot/sabayon.igz
For Gentoo2) something like this should work (needs testing):default=0 timeout=15 title Gentoo Linux root (hd0,0) kernel /boot/gentoo root=/dev/ram0 looptype=squashfs loop=/image.squashfs vga=0x31a CONSOLE=/dev/tty1 verbose scandelay initrd udev nodevfs cdroot \ aufs init=/linuxrc max_loop=64 initrd /boot/gentoo.igz
- Write the boot loader. This only needs to be done once since GRUB dynamically reads the configuration file during boot. Change hd# to be your USB device (careful!), such as hd1 if it is sdb, hd2 if it is sdc, etc. Use the TAB key in GRUB to see which drives you have available.
grub root (hd<TAB→>,0) setup (hd<TAB→>)
Finishing
umount /mnt/usbstick
The USB stick should now boot Linux.
References
- GNU GRUB (GRand Unified Boot-loader), Legacy documentation
Future research
Some interesting sites for future expansion of this topic that are not yet referenced here.