Install Openfiler onto the USB Key
- Disconnect all hard disks from the server.
- Boot from the Openfiler CD and install Openfiler by invoking the linux expert command and installing as normal onto your USB key, taking into account your partitioning to fit onto your USB key and also making a record of which partitions are your /boot and your / partitions.
Create a new ramdisk that includes the USB drivers.
When installation is complete, reboot the server with the Openfiler CD still in the drive and then type
- Go through the menus and select your region and keyboard and skip the automatic mounting of your installed OS. We will do this manually.
When the prompt appears, create a directory to mount the USB key.
Now mount the / of the USB key onto /mnt/sysimage.
mount /dev/sda2 /mnt/sysimage
Note: your / partition may be /dev/sda3 instead, depending on how you setup your partitioning during the installation of Openfiler.
Now mount the boot partition of the USB key onto /mnt/sysimage/boot.
mount /dev/sda1 /mnt/sysimage
Note: your / partition may be /dev/sda1 instead, depending on how you setup your partitioning during the installation of Openfiler.
Make the /mnt/sysimage your working environment by changing your root location so you are working on the file system on the usb key.
Copy the current initrd file to a temporary location where we can work on it.
cp /boot/initrd-1 /tmp/initrd.gz
Note1: now’s a good time to press TAB
Gunzip the initrd.gz file
Make a temporary working directory
Go into the new working directory
Extract the contents of the initrd file into /tmp/a.
cpio –i < /tmp/initrd
Now we edit the init file to load the USB and SCSI drivers for the new initrd-usb.img ramdisk.
Do a search for “mount –t proc /proc /proc” and add the following underneath this line. We want to load these USB and storage modules before any other modules that’s why these entries need to be at the top of the file.
echo “Starting Openfiler on USB”
echo “Loading scsi_mod.ko module”
echo “Loading sr_mod.ko module”
echo “Loading sd_mod.ko module”
echo “Loading ehci-hcd.ko module”
echo “Loading uhci-hcd.ko module”
echo “Loading ohci-hcd.ko module”
echo “Loading usb-storage.ko module”
- Do a search for insmod /lib/scsi_mod.ko, insmod /lib/sd_mod.ko, insmod /lib/ehci-hcd.ko and insmod /lib/uhci-hcd.ko and remove these duplicate entries from the rest of the file. We do not want these loaded again.
- Save the file and exit with CTRL X, then Y, or if you used vi then :wq!
- Now we need to copy all of the modules in Step 13 into our working directory.
Go to the drivers directory
Note2: just press tab to fill in this bit, you should only have one kernel.
Copy all of the modules in Step 13 to /tmp/a/lib.
cp scsi/scsi_mod.ko /tmp/a/lib
cp scsi/sr_mod.ko /tmp/a/lib
cp scsi/sd_mod.ko /tmp/a/lib
cp usb/host/ehci-hcd.ko /tmp/a/lib
cp usb/host/uhci-hcd.ko /tmp/a/lib
cp usb/host/ohci-hcd.ko /tmp/a/lib
cp usb/storage/usb-storage.ko /tmp/a/lib
Now let’s package the contents of the working directory /tmp/a into our new initrd-usb.img.
find . | cpio –c –o | gzip -9 > /boot/initrd-usb.img
Now all we need to do is edit the /boot/grub/menu.1st file to tell the kernel to use the new ramdisk that we just created. Remember that this new ramdisk is currently located in /boot/ (aka /dev/sda1) and is called initrd-usb.img.
Find the line starting with initrd /vmlinux-…………………… and replace with
- Save the file and reboot the computer, remove the CD and allowing it to boot from the USB key. You now have your Openfiler installation booting from the USB key directly.