Booting from 8GB USB flash memory sticks? (was RE: [lug] Next Install Fest)
svqueen at gmail.com
Wed Jan 10 12:53:36 MST 2007
On 1/10/07, siegfried <siegfried at heintze.com> wrote:
> I just had another thought: I've been google searching for the procedure to
> boot from a USB flash memory stick. I think this would be an extremely
> useful thing to do. Does anyone know how to do this? I have a few links I'm
> currently reading up on that I have found by google searching and posting
> queries in forums. Someone in some forum explained that FC6 requires 7GB. I
> just found some 8GB flash memory USB sticks for $100. 16GB and 32GB sticks
> are available for more $.
> Would this be a topic for a monthly meeting or an install fest? Has anyone
> done this? I would love to have a meeting where we have a presentation on
> booting from a USB memory stick followed by a laboratory exercise where we
> all configure our computers to boot from our own flash memory sticks.
I got grub to load from the MBR of a 1 GB stick once. I didn't have a
kernel or anything for it to boot, I was just playing.
I have loaded linux on a 20 GB USB Hard Drive for some people at work,
that didn't want to modify there company supplied laptops, but were
interested in running linux. It is a fairly simple process. Most of it
involves either configuring initrd to load the correct drivers and
then doing the pivot-root correctly, or maybe just compiling the
kernel with the drivers. I haven't tried the 2nd method so I don't
know how well it works.
The initrd is an image compressed into a cramfs. The image contains
what amounts to be a simple, minimum linux image.
A ls -1 of the initrd would look like this
The important file to modify is the linuxrc file. Here is what is in
one of the ones I have working.
if [ "$1" != "0" ] ; then
mount -nt proc proc proc
chkerr $? "Error in getting real root "
echo 256 > proc/sys/kernel/real-root-dev
chkerr $? "Error in setting real root "
chkerr $? "Error in generated script"
#echo $root > /bin/root
#echo 2049 > /bin/root
mount -o ro -nt ext3 /dev/sda1 new-root > /dev/null 2>&1
chkerr $? "Error mounting /dev/sda1"
#echo $root > /new-root/bin/root
chkerr $? "Error cd new-root"
/sbin/pivot_root . mnt
chkerr $? "Error in pivot_root"
exec chroot . sh -c 'umount /mnt ; umount /' < dev/console > dev/console 2>&1
The script loadmodules looks like
modprobe -k unix 2> /dev/null
modprobe -k sd_mod
modprobe -k uhci-hcd
modprobe -k ehci-hcd
modprobe -k ide-core
modprobe -k usbcore
modprobe -k scsi_mod
modprobe -k usb-hid
modprobe -k usb-storage
modprobe -k ide-disk
modprobe -k mbcache
modprobe -k rtc
modprobe -k jbd
modprobe -k ext3
modprobe -k evdev
One of the things to remember is that for every command you use in
your scripts, you must load the command into the proper directory and
make sure you copy all the libraries the command needs.
Once you have it all in place run grub, and boot. Sounds simple huh?
More information about the LUG