Openfiler running from 2GB SD card

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
  No swap!
  • 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:

cd /boot
mv initrd-2.6.29.6-0.6.smp.gcc3.4.x86_64.img initrd-2.6.29.6-0.6.smp.gcc3.4.x86_64.img.old
mkinitrd –preload ehci-hcd –with usb-storage initrd-2.6.29.6-0.6.smp.gcc3.4.x86_64.img 2.6.29.6-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

nano /etc/fstab

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

mkdir /mnt1
mkdir /mnt2
mount -t ext2 /dev/sdb2 /mnt1
mount -t ext2 /dev/sdd2 /mnt2
cp -a /mnt1 /mnt2
umount /mnt1
umount /mnt2
mount -t ext2 /dev/sdb3 /mnt1
mount -t ext2 /dev/sdd3 /mnt2
cp -a /mnt1 /mnt2
umount /mnt1
umount /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.
Advertisements

4 thoughts on “Openfiler running from 2GB SD card

  1. I’m interested in why you say No Swap! Is this because having swap on a CD card is a bad idea (e.g. because of write wear)?
    Or did you have enough RAM to not need any swap? or did some part of your process require that you don’t have swap?

    I’ve been testing Openfiler from a 8GB Class 6 SDHC card and was concerned about whether the SWAP would be causing write wear and whether I could do without it.

    Interesting articles in your blog.

    Simon

    1. I chose not to have swap on the SD card because of the fear of write wear. If you think your SD card will handle it then there is nothing else that would prevent swap usage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s