It is neccessary to wait a few seconds before mounting the root filesystem when booting from a USB disk. This can be accomplished by three different approches. Either use the boot parameter 'rootdelay' or use a initrd which contains a 'sleep 10' statement before the root filesystem is mounted. The third metod is to use a initrd which searches for the root partition by using the partition LABEL or UUID. See below "initrd with support for UUID and LABEL" IMPORTANT: /etc/fstab must always contain the correct device to mount as root. It is possible to use the filesystems UUID or LABEL in /etc/fstab if the USB disk gets a different devicename like /dev/sdc instead of /dev/sda between reboots. It is also possible to use /dev/root if the kernel and system supports it. Something like this: /dev/root / ext4 defaults 1 1 or this: LABEL="SW_13.0" / ext4 defaults 1 1 Slackware 13.0 is delivered with a initrd.gz which can find the root filesystem by label. Boot with: root=LABEL=PUTLABELHERE rootfs=ext4 To wait for USB, append: waitforroot=15 What to put in lilo.conf ------------------------ Wait 10 seconds before trying to mount the root filesystem from /dev/sdc1. IMPORTANT: This must be the physical device for the partition. Label or UUID doesn't work unless using an initrd. /etc/lilo.conf image=/boot/vmlinuz append="rootdelay=10 root=/dev/sdc1" label=root->sdc1 read-only When booting from the Lilo prompt ---------------------------------- Two simple steps are needed: 1. You need to specify the correct root partition at the Lilo boot prompt. Example, assuming the root partition is /dev/sda1: IMPORTANT: This must be the physical device for the partition. Label or UUID doesn't work unless using an initrd. WhatEverKernelImage rootdelay=10 root=/dev/sda1 2. You need to specify the correct root partition in /etc/fstab, either by UUID, LABEL or physical device. It is also possible to use /dev/root if the kernel and system supports it. Example, assuming the root partition is device /dev/sda1: /dev/sda1 / ext3 defaults 1 1 Example, by using a label: LABEL="MEDIA-ROOT" / reiserfs defaults 1 1 Example, by using UUID: UUID="1789683e-c85a-45b7-bdf1-8bb04fc6275c" / ext3 defaults 1 1 Example, by using /dev/root: /dev/root / ext3 defaults 1 1 ------------ Use an initrd with a 10s delay before mounting root --------------------------------------------------- Do a normal install to the USB drive including lilo (set to boot from MBR on the USB drive). Will probably not boot - so we need to boot from a initrd and add a delay after the filesystem modules has been loaded and before the kernel attempts to mount the root partition. Use an identical linux installation on the harddrive to create a initrd which later can be copied to the USB drive. Create a initrd with support for ext3, set the root partition to /dev/sdc1 and of type ext3. cd /boot mkinitrd -c -k 2.6.21.5-smp -m ext3 -f ext3 -r /dev/sdc1 Modify the initrd to wait 10s before mounting root partition: cd initrd-tree Remove file "load_kernel_modules" (not neccessary?) Add sleep 10 before the line "# Initialize LVM:" in file "init" Recreate the initrd by running mkinitrd without arguments: mkinitrd mount the USB device as /mnt. mount /dev/sdc1 /mnt Copy the file initrd.gz to /boot in the USB device. cp /boot/initrd.gz /mnt/boot Edit /mnt/etc/lilo.conf and add the initrd image=/boot/vmlinuz initrd=/boot/initrd.gz root=/dev/sdc1 label=Slackware12 read-only Update MBR on the USB device by running lilo with root as /mnt Test first: lilo -t -v -r /mnt If it looks good do the sharp version: lilo -v -r /mnt Unmount /mnt and reboot!
initrd with support for UUID and LABEL
See this link for an updated guide: Initrd with LABEL/UUID support
See also this for some similar stuff: Upix LiveCD/DVD/USB
cd /boot --- Create a basic initrd image Use the current kernel: mkinitrd -c -m reiserfs specific kernel: mkinitrd -c -k 2.6.21.5-new -m reiserfs --- Label the root filesystem Must be done from a LiveCD or similar since the filesystem must be unmounted. reiser: reiserfstune --label ROOT_FS /dev/sda2 ---- ext2/ext3: e2label /dev/sda2 ROOT_FS ---- Replace /boot/initrd-tree/init with modified version Make sure that the correct LABEL is used. See below newinit.txt ---- Copy binaries to mybin (Must not be in bin. Interfers with busybox..) Only copy binaries which does not have a busybox alternative. awk blkid mkdir /boot/initrd-tree/mybin cp /usr/bin/awk /boot/initrd-tree/mybin cp /sbin/blkid /boot/initrd-tree/mybin Copy libraries to lib ld-linux.so.2 libblkid.so.1 libc.so.6 libdl.so.2 libm.so.6 libuuid.so.1 cp /lib/ld-linux.so.2 /boot/initrd-tree/lib/ cp /lib/libblkid.so.1 /boot/initrd-tree/lib/ cp /lib/libc.so.6 /boot/initrd-tree/lib/ cp /lib/libdl.so.2 /boot/initrd-tree/lib/ cp /lib/libm.so.6 /boot/initrd-tree/lib/ cp /lib/libuuid.so.1 /boot/initrd-tree/lib/ --- Copy modules to /lib/modules Optional! Only if the kernel lacks some critical driver needed for bootup cp -r /lib/modules/2.6.21.5/kernel/ /boot/initrd-tree/lib/modules/2.6.21.5-new/ The modules could also be built in the kernel.. Remove file "load_kernel_modules" so that ALL modules will be loaded --- Install device files from the Slackware DVD: mount /dev/dvd /mnt/dvd installpkg -root /boot/initrd-tree /mnt/dvd/slackware/a/devs-2.3.1-noarch-25.tgz Create a new initrd which contains the modifications cd /boot mkinitrd Update Lilo/Grub Can be booted from USB stick if you want to try it out first. /etc/lilo.conf image = /boot/vmlinuz initrd = /boot/initrd.gz append="rootdelay=10 acpi_sleep=s3_mode" label = initrd read-only # Partitions should be mounted read-only for checking Test first: lilo -t -v -C /etc/lilo.conf.usb If OK: lilo -v -C /etc/lilo.conf.usb
Files:
