Gentoo minimal CD on USB stick
From Gentoo Linux Wiki
[edit] Building a Minimal Install Gentoo USB - Option 1
download Gentoo minimal CD ISO
mkdir /downloads cd /downloads wget http://bouncer.gentoo.org/fetch/gentoo-2008.0-minimal/x86/
emerge the necessary tools
emerge syslinux
Find your usb flash drive
fdisk -l
Unmount if mounted
umount /dev/sdb1
Clear disk partition table and boot sector
dd if=/dev/zero of=/dev/sdb count=1024
create a primary partitions of type 83 - ext2 with fdisk and make it bootable
fdisk /dev/sdb n p 1 enter enter t 83 a 1 p w
Device Boot Start End Blocks Id System /dev/sdb1 * 1 1009 500433 83 Linux
Formate the partition ext2 and tune it
mkfs.ext2 /dev/sdb1 tune2fs -i 0 /dev/sdb1
install the mbr
equery f sys-boot/syslinux | grep mbr cat /usr/share/syslinux/mbr.bin > /dev/sdb
mount the usb flash drive and disk image
mount -t ext2 /dev/sdb1 /media/usbdisk/ mount -t iso9660 -o loop,user /downloads/install-x86-minimal-2008.0.iso /media/cdiso
install the system files
cd /media/usbdisk/ cp -r /media/cdiso/* /media/usbdisk/ mv isolinux extlinux mv extlinux/isolinux.cfg extlinux/extlinux.conf rm extlinux/isolinux.bin rsync -av extlinux
install the bootloader
cd /mnt extlinux -i /media/usbdisk/extlinux umount /media/usbdisk
Note: Some older machines will not boot a usb formatted in ext2.
[edit] Building a Minimal Install Gentoo USB - Option 2
Gentoo can be installed using SystemRescueCD on a usb flash drive, which has many tools not available on the gentoo minimal install. SystemRescueCD is a gentoo distro.
This howto used gentoo, a sandisk cruzer skins 512MB and systemrescuecd 1.1.4
point a browser at http://downloads.sourceforge.net/systemrescuecd select the latest version and download
mkdir /downloads cd /downloads wget http://downloads.sourceforge.net/systemrescuecd/systemrescuecd-x86-1.1.4.iso
emerge the necessary tools
emerge dosfstools emerge syslinux emerge ddrescue emerge ms-sys
Comment out line 3 of the syslinux config file /etc/mtools/mtools.conf by prefixing it with a hash mark (#).
nano /etc/mtools/mtools.conf #SAMPLE ctrl X
find your usb drive
fdisk -l
unmount if it is mounted
unmount /dev/sdb1
Windows writes something weird to the boot sector of usb flash drives so erase the first 512 bytes with a string of zeros
ddrescue /dev/zero /dev/sdb -s512
create a primary partitions of type e - W95 FAT16 LBA with fdisk and make it bootable
fdisk /dev/sdb n p 1 enter enter t e a 1 p w
Device Boot Start End Blocks Id System /dev/sdb1 * 1 1009 500433 e W95 FAT16 (LBA)
formate the partitions in fat16
mkfs.vfat -F 16 /dev/sdb1
mount the boot partition and cd image
mount -t vfat /dev/sdb1 /media/usbdisk/ mount -t iso9660 -o loop,user /downloads/systemrescuecd-x86-1.1.4.iso /media/cdiso/
install the system files from SystemRescueCd
cp -r /media/cdiso/* /media/usbdisk/ mv /media/usbdisk/isolinux/isolinux.cfg /media/usbdisk/isolinux/syslinux.cfg mv /media/usbdisk/isolinux /media/usbdisk/syslinux
install the bootloader
umount /media/usbdisk ms-sys -s /dev/sdb syslinux /dev/sdb1 sync
Note:
Not all usb flash disks are equal! The sandisk 512MB is an old flash drive and won't boot on all machines (it hangs mounting the drive). The same process with a Sony Micro Vault Tiny 1GB is more compatible.