I am building my home lab for VMware vSphere testing. To use advanced features vSphere offers external storage is a must. There are many options. My choices were to buy NAS (my favorite is Iomega StorCenter ix4-200d which is even on vSphere HCL), use my file server linux box with NFS exports or build an open source NAS that supports iSCSI. vSphere supports NFS, so standard linux with NFS-kernel-server is an option, however you cannot use vStorage thin provisioning. I needed flexibility, which buying NAS would not offer (5×1 TB RAID5 for my files and 2x 500GB RAID1 for vSphere) and so decided to change my file server into an Openfiler appliance. This way I could still use it as file server with samba shares for my Windows station and also as iSCSI storage for vSphere ESX 4 hosts. To maximize the number of disks I could put into the box I decided to boot it from SD card. Unfortunately that is not an easy task. There are many guides on the Openfiler forum, however at the end I came up with my own solution with the help of VMware Workstation.
- Download ISO from here
- Create VM in Workstation with similar setup as the physical machine that will be used for Openfiler. In my case with 2 GB HDD, 2 GB RAM and 3 e1000 NICs.
- Install Openfiler with linux text expert option
- Select Druid partitioning option and make these partitions:
|/boot||100 MB EXT2|
|/||1200 MB EXT2|
|/var||512 MB EXT2|
- After installation, log in via web interface and update Openfiler. Use background update. It takes some time. Reboot.
- Before moving the installation to SD card we must add USB storage drivers to boot image:
mv initrd-126.96.36.199-0.6.smp.gcc3.4.x86_64.img initrd-188.8.131.52-0.6.smp.gcc3.4.x86_64.img.old
mkinitrd –preload ehci-hcd –with usb-storage initrd-184.108.40.206-0.6.smp.gcc3.4.x86_64.img 220.127.116.11-0.6.smp.gcc3.4.x86_64
- Edit the fstab options to protect the limited writes of SD card with noatime option and moving some folders to ramdrive
LABEL=/ / ext2 defaults,noatime 0 0
LABEL=/boot /boot ext2 defaults,noatime 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults,noatime 0 0
/proc /proc proc defaults,noatime 0 0
/sys /sys sysfs defaults,noatime 0 0
LABEL=/var /var ext2 defaults,noatime 0 0
tmpfs /tmp tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0
- Do any additional customizations (admin password, NIC setup, etc.)
- Once we are done we can transfer the image to SD card. For that I used another linux VM with Debian. I added the VMDK disk from Openfiler VM and plugged in SD with physical access to Debian VM (little icon in the right corner of VMware Workstation – Disconnect from Host).
- With fdisk create /boot / and /var partitions same size and filesystem as in Openfiler install
- copy boot partition with dd (/dev/sdb is Openfiler disk, /dev/sdd is SD card
dd /dev/sdb1 /dev/sdd1
- copy the rest with cp
mount -t ext2 /dev/sdb2 /mnt1
mount -t ext2 /dev/sdd2 /mnt2
cp -a /mnt1 /mnt2
mount -t ext2 /dev/sdb3 /mnt1
mount -t ext2 /dev/sdd3 /mnt2
cp -a /mnt1 /mnt2
- label the partition so they can be mounted properly
e2label /dev/sdd1 /boot
e2label /dev/sdd2 /
e2label /dev/sdd3 /var
- We are done. Now the SD card is ready to be inserted into the physical Openfiler machine.