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
linux rescue
- 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.
mkdir /mnt/sysimage
-
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.
chroot /mnt/sysimage
-
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
gunzip /tmp/initrd.gz
-
Make a temporary working directory
mkdir /tmp/a
-
Go into the new working directory
cd /tmp/a
-
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.
nano init
-
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”
insmod /lib/scsi_mod.ko
echo “Loading sr_mod.ko module”
insmod /lib/sr_mod.ko
echo “Loading sd_mod.ko module”
insmod /lib/sd_mod.ko
echo “Loading ehci-hcd.ko module”
insmod /lib/ehci-hcd.ko
echo “Loading uhci-hcd.ko module”
insmod /lib/uhci-hcd.ko
echo “Loading ohci-hcd.ko module”
insmod /lib/ohci-hcd.ko
sleep 5
echo “Loading usb-storage.ko module”
insmod /lib/usb-storage.ko
sleep 5
- 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
cd /lib/modules/2/kernel/drivers
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.
cd /tmp/a
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.
nano /boot/grub/menu.1st
-
Find the line starting with initrd /vmlinux-…………………… and replace with
initrd /initrd-usb.img
- 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.
Is this based off of OF 2.3 or 2.99? Or does it not matter/work with both?
I just ran through this ‘how to’ (a couple of times) and it seems to work perfectly…but…upon first boot to the USB ‘drive’ it prints “GRUB” on the screen and stops booting. After a hard reboot, the same thing happens. Any ideas?
It is very good practice for Openfiler. By the way, is it practical to use software RAID built-in in Operfiler setup to configure RAID-1 for dual USB drive?