Using iocage on Freenas

Since the old jail system on Freenas is soon to be removed, they want users to migrate to iocage instead.

You can only administrate iocage jails via the new (beta) Web UI, with limited functionality however.

Here’s a quick reference on how to create a new jail, add network and mount a dataset in it.

Before I started I created a test-jail in the new Web UI, which downloaded the template for FreeBSD 11.1.

After that has been done (the test jail can be removed) you can run the following commands via the CLI.

Create the Jail:
iocage create -r 11.1-RELEASE -n '[jailname]' (ex. iocage create -r 11.1-RELEASE -n 'backup')

Set IP address for the jail:
iocage set ip4_addr='[interface]|[ipaddress]/24' '[jailname]' (ex. iocage set ip4_addr='lagg0|192.168.11.28/24' backup)

Add a dataset to the jail:
iocage fstab -a [jailname] /mnt/Storage/[dataset] (ex. iocage fstab -a backup /mnt/Storage/Snapshots)
iocage fstab -e [jailname] (change ro to rw in fstab if you want the dataset writable)

Create the folder in the jail for the dataset:
mkdir -p /mnt/Storage/iocage/jails/[jailname]/root/mnt/Storage/[dataset] (ex. mkdir -p /mnt/Storage/iocage/jails/backup/root/mnt/Storage/Snapshots)

Do take note that the mount or jailname should Not have any spaces in the name, if there are spaces in the name the mount/fstab command does not work because nullfs does not support spaces at this moment.

You can now start the jail via the new interface, or via CLI with the command:

iocage start [jailname]

Reflash LSI MegaRAID 9240-8i to 9211-8i

Creating this post for future reference because I can never really remember how to firmware upgrade my raid card LSI MegaRAID SAS 9240-8i, which is now a LSI MegaRAID SAS 9211-8i.

Basically this guide is a rewrite of this forum post.

  1. Created a standard bootable DOS USB Flash Drive.
  2. Download the firmware tools (local mirror) and extract MegaRec.exe and empty.bin to the USB drive.
  3. Download the latest 9211-8i firmware.
  4. Copy the following files to the USB drive:
    – 2118it.bin
    – sas2flsh.exe (DOS-version)
    – mptsas2.rom
  5. Boot from USB.
  6. Backup current sbr with megarec -readsbr 0 backup.sbr
  7. Write an empty sbr with megarec -writesbr 0 empty.bin
  8. Erase controller flash with megarec -cleanflash 0
  9. Restart machine and boot from USB again.
  10. Set controller to 6GB/s mode with sas2flsh -o -e 6
  11. This process will ask for the firmware file. Write 2118it.bin
  12. Flash the controller with the new firmware with IT-mode with sas2flsh -o -f 2118it.bin -b mptsas2.rom
  13. Program SAS address in IT-mode where 500605b********* is the code on the green sticker on your RAID card without the “-” with sas2flsh -o -sasadd 500605b*********

Done for this time! Enjoy your reflashed LSI 9240-8i which is now an LSI 9211-8i!

If you ever need to update the firmware, you can do it like this on (for example) FreeBSD:

  1. Download the latest firmware and installer package from LSI.
  2. Flash with ./sas2flash -o -f 2118it.bin

My trip from Windows Home Server 2011 to FreeNAS

Last weekend I decided to finally take the step and move yet another server away from Microsoft’s claws and into the Open Source camp. A strong point why I’ve kept WHS (Windows Home Server) for so long is that I really love the automatic-client-backup which has helped me while toying around with my laptop a bunch of times.

I did check out the replacement for WHS which Microsoft calls Windows Server 2012 R2 Essentials and did use it for a couple of days before deciding to move back to WHS again. A Domain Network should not be forced to even be able to use the client utility, there is a workaround for it but didn’t quite do it for me plus the domain network setup broke my network setup AND the profiles on my workstations for a while.
Using the Storage Spaces to set the disks in a “RAID5-like enviroment” completely killed the write speeds which made my decision to rollback to WHS even easier.

I’ve heard recommendations about FreeNAS from a few friends and decided to read more about it about half a year ago. I have been checking in at their documentation/wiki and website ever since to keep myself updated with the changes and functions that exists in their releases.

About a year ago I bought a new Raid-card to move onto a better RAID5-solution rather than putting my trust into software raid using DriveBender. Drivebender is a really potent software and has only let me down once in the earlier versions. I was however able to recover all my data with the help from their support-team, but I wanted something more reliable and hardware focused.

I looked into buying a Raid-card to ease my heart and did some research and decided to get an LSI MegaRAID SAS 9240-8i. Now some of you will start screaming at me right now, but hold on! I’m not done yet!
I finally got the card in the mail and attempted to put it into Applejack (the storage server). Sadly the computer did not pass POST correctly. After contacting LSI’s support department they determined that my motherboard was too old. I also later found out that the LSI-card I had bought is only a “fake raid” card, or software-based raid which means not too reliable and not very fast in RAID5-mode.

By then I gave up on the upgrading idea and continued using DriveBender a while longer, but I still looking for what motherboard to buy and kept the firmware updated on the LSI-card from my workstation.

Months went by and my love for Microsoft products has been fading and I’ve been slowly going towards the OpenSource-community and solutions. I looked around and I found that my LSI card should work with FreeNAS. “Awesome!” – I went and bought a new motherboard, upgraded the processor and chipped in some extra RAM at the same time into Applejack (from Intel socket 775 to 1155).

I moved all the important data away from Applejack (still using WHS 2011) and then installed FreeNAS onto an USB-drive to run it from. I put in the Raid-card into Applejack again and waited for it to boot up.. After about ten minutes I decided to plug a monitor into her to see what was up, seems like the LSI card is not fully compatible with FreeNAS in the end and couldn’t detect my drives..

“Time to ask almighty Google!” – After a few searches I found that the LSI-card I bought Can be reflashed into LSI 9211, which is a lot more compatible with all operating systems.

I put the card into my workstation, reflashed it into a 9211-card and put it back into Applejack. “Woo hoo! She’s alive!” – A few minutes later Applejack boots up into FreeNAS!

I configured up my four 2TB Samsung drives to run in RAIDZ-mode (I know, I know, not optimal according to FreeNAS) and added the SSD-drive as both a ZIL and L2ARC-drive to make both reads and writes a little faster and easier on the actual storage drives. This can be done by partitioning the SSD into two slices, one smaller partition for ZIL and rest of the drive for L2ARC and then connecting to the FreeNAS-machine via ssh and running two commands.
zpool add <pool> log <partition> and zpool add <pool> cache <partition>

Unfortunately I did not test the RAIDZ performance before adding the SSD-drive, but I get a blazing 75MB/s write speed for concurrent writes over CIFS if you’d believe Windows 7’s file transfer dialogue. I’m happy and feel more at ease with a safer drive-setup and I don’t have to think about patch-Tuesdays for Applejack any more. Yay!

As a substitute for client backups would be to use the built-in “Backup and Restore”-utility on each client, if I don’t go for some other solution in the future!

Please note (cut from FreeNAS Users Guide):
No raid solution provides a replacement for a reliable backup strategy. Bad stuff can still happen and you will be glad that you backed up your data when it does.