Gentoo Wiki


Merge-arrows.gifIt has been suggested that this article be Merged into one article with Live USB stick using GRUB.    (Discuss)

This is the perfect project for that spare 1GB usb key you have laying dormant in your desk drawer.



This HOWTO makes puts the latest Gentoo release onto a USB key and makes it bootable.

Sample reasons to follow this HOWTO include:

The Gentoo Linux LiveUSB HOWTO documents how to emulate a Gentoo Linux 2007.0 LiveCD using a USB flash drive. With 2008.0, Gentoo started to use GRUB as the bootloader for installation media so an updated procedure is required.

Note: As the latest official documentation the HOWTO is still worth reading for background information.

For this HOWTO we choose to use the FAT filesytem and the GRUB bootloader. GRUB because it was chosen by Gentoo Release Engineering for their latest releases, and because it allows for the simplest procedure. We choose FAT because it is ubiquitous on these devices, see Wikipedia

The HOWTO LiveUSB uses the ext3 filesystem and the extlinux bootloader.


We will check the partition table, reformat the device, mount it and the install media, copy some files, unmount both, install the bootloader and then test the finished product!

Note: Make sure you don't mix up your architectures. GRUB and the LiveCD must be the same architecture as your target. If you run a 64 bit Linux, you will need to use a 32 bit chroot in order to create a LiveUSB Key for a 32 bit computer.

Check Partition Table

Warning: Important: This HOWTO assumes that the /dev/sdc device node corresponds to your USB flash drive. If you have other SCSI-like devices make sure to use the correct device node.
Note: Refer to the "Preparing the Disks" section of the Gentoo Handbook for additional information about partitioning disks.

To read the partition table use:

fdisk -l /dev/sdc
Code: Sample fdisk Output
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

The key should contain a single partition using all of the available space. For a key smaller than 4GB the System column should read FAT16; set the type to 6. If your key is 4GB or larger it should be W95 FAT32; partition type b.

Running the fdisk command without the -l switch modifies the partition table:

fdisk /dev/sdc


Formatting the disk ensures a blank slate for the rest of the procedure. Depending on the size of your device, a slightly different filesystem is required. Note that you will need sys-fs/dosfstools emerged to have the mkdosfs command available.

Create a blank FAT file system on your device, if smaller than 4GB:

mkdosfs -F 16 /dev/sdc1 

If 4GB or larger, create a blank FAT file system:

mkdosfs -F 32 /dev/sdc1

Mount Devices

You will need a copy of a 2008.0 ISO image which you can download from the Get Gentoo! page. Here we mount this image and the target USB key onto the local file hierarchy. Replace image.iso below with the filename of your download.

mkdir -p /mnt/cdrom /mnt/usb
mount -o loop image.iso /mnt/cdrom
mount /dev/sdc1 /mnt/usb

Copy Files

The sys-boot/grub package includes GRUB stages which we now copy onto the USB key, later we will install them into the key's MBR.

Copy over the ISO contents and GRUB stages:

cp -r /mnt/cdrom/* /mnt/usb
cp /lib/grub/i386-pc/stage1 /mnt/usb/boot/grub/
cp /lib/grub/i386-pc/stage2 /mnt/usb/boot/grub/
cp /lib/grub/i386-pc/fat_stage1_5 /mnt/usb/boot/grub/

Unmount Devices

All of the required files are now on the USB key, so we can detach the disc image and the USB key from the directory tree.

umount /mnt/cdrom
umount /mnt/usb

Install GRUB

Note: Refer to the "Configuring the Bootloader" section of the Gentoo Handbook for additional information about installing GRUB.

GRUB can be installed onto the USB key in either of two ways: using grub-install or manually. grub-install needs to probe devices so will not work in a chroot.

The Gentoo Grub Error Collection documents some common problems installing GRUB.

Using grub-install

Warning: Check the partition below is correct or you may overwrite your existing distribution's boot loader.
grub-install /dev/sdc1



Then at the GRUB command line:

Warning: Check that the partition below; (hd1,0), and the device; (hd1), are correct or you may overwrite your existing hard disk boot loader.
grub> root (hd1,0)
grub> setup (hd1)
grub> quit


You should now have a USB key which will run the latest Gentoo release media. Insert it and turn on the the target computer, making sure the BIOS is set to boot from USB. You should now have booted your favorite operating system.

Retrieved from ""

Last modified: Thu, 02 Oct 2008 11:10:00 +0000 Hits: 4,544