Search:  
Gentoo Wiki

HOWTO_LiveUSB

Contents

Introduction

Creating a LiveUSB device from the latest LiveCD or LiveDVD is easy. Here we use extlinux as the boot loader.

Notational Conventions

Process

Format The Device

We first partition it into one big bucket of bytes, and then run mkfs.ext3 to format it. At this stage, we do two things to ensure the device is bootable -- use the a directive in fdisk, and put a Master Boot Record on the device.

Code: Preparing Media
fdisk /dev/sda
Command (m for help): d
Selected partition 1

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

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

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

Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.ext3 /dev/sda1
mke2fs 1.40.3 (05-Dec-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125952 inodes, 251712 blocks
12585 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
15744 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
cat /usr/lib/syslinux/mbr.bin > /dev/sda

Note: current version of syslinux uses /usr/share folder so if above command fails try:

cat /usr/share/syslinux/mbr.bin > /dev/sda

Copy The ISO

We use the -p with cp to preserve file permissions, and the -P option to ensure symlinks are never followed. The copy will take quite some time with the DVD.

Code: Copy
mount -o loop -t iso9660 ~/that.iso /media/live-iso
mount /dev/sda1 /media/usb
cp -a /media/live-iso/* /media/usb

Add The Bootloader

Many other tutorials encourage you to use the FAT16 filesystem or one of its derivatives. For that filesystem, use syslinux; however, we are using ext3, so we need extlinux. The extlinux installer is called on the directory that contains the boot info -- in this case /media/usb/isolinux. It's okay to use the isolinux config file as is with extlinux.

Code: Bootloader
pushd /media/usb
mv isolinux extlinux
mv extlinux/isolinux.cfg extlinux/extlinux.conf
rm extlinux/isolinux.bin
popd
extlinux -i /media/usb/extlinux 

Unmount Everything

Once you are done, unmount everything and pull out the USB device. With your bootable Gentoo LiveUSB, you can boot UMPCs for great justice!

Code: Unmount It All
umount /media/usb
umount /media/live-iso

Tools

These less common packages have appeared in this tutorial:

Retrieved from "http://www.gentoo-wiki.info/Live_USB_stick_using_extlinux"

Last modified: Thu, 02 Oct 2008 11:20:00 +0000 Hits: 4,581