HOWTO LiveUSB Key
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
This is the perfect project for that spare 1GB usb key you have laying dormant in your desk drawer.
Contents |
[edit] purpose
The latest 2008.0 beta LiveCD iso images at just over 800MB are larger than a regular CD you may have laying around. I wanted to test to the new image some how, and the official Gentoo Linux LiveUSB HOWTO I found was not completely functional as the LiveCD's now use Grub instead of isolinux, which is expected.
You may have already read HOWTO LiveUSB. This HOWTO uses FAT16 or FAT32 as the filesystem type and format, as outlined in the official LiveUSB HOWTO. You could use EXT3, or another filesystem type with your USB key, but that is not presently within the scope of this guide.
[edit] instructions
Not a lot changes really so you should read the Gentoo Linux LiveUSB HOWTO to better familiarize yourself with the process.
[edit] partitioning
This guide assumes you're using a drive smaller than 4GB. If your key is 4GB or larger, use partition type b (W95 FAT32) otherwise use type 6 (FAT16).
fdisk -l /dev/sdc
Disk /dev/sdc: 2063 MB, 2063597056 bytes
255 heads, 63 sectors/track, 250 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 250 2008124+ 6 FAT16
[edit] file system
Create a FAT 16 file system.
mkdosfs -F 16 /dev/sdc1
[edit] master boot record
Copy over the mbr image.
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdc
[edit] mounting iso
You will need to have one of the 2008.0 beta2 iso images which you can find from in the Gentoo mirrors.
mkdir -p /mnt/cdrom mount -o loop,ro -t iso9660 livecd-i686-installer-2008.0_beta2.iso /mnt/cdrom
[edit] mounting usb key
mkdir -p /mnt/usb mount -t vfat /dev/sdc1 /mnt/usb
[edit] copying files
Now the order here is important, otherwise you will loose the menu.lst from the iso.
Copy over your local grub files.
cp -a /boot/grub /mnt/usb/boot
Copy over the files from your iso.
cp -rv /mnt/cdrom/* /mnt/usb
sync;sync your filesystems.
[edit] unmount iso
umount /mnt/cdrom
[edit] unmount usb key
umount /mnt/usb
[edit] installing grub
grub-install /dev/sdc1 grub grub> root (hd1,0) grub> setup (hd1) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/fat_stage1_5" exists... yes Running "embed /boot/grub/fat_stage1_5 (hd1)"... 16 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd1) (hd1)1+16 p (hd1,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded Done.
[edit] done
That's it. Now you should have a bootable USB key running the latest Gentoo LiveCD environment, which allows you to easily install your favorite operating system just about anywhere.
