FreeNAS 8 running on Virtualbox

Installing FreeNAS on VirtualBox

A reader recently commented on my post about upgrading to FreeNAS version 8 and asked if I had any advice for installing FreeNAS on VirtualBox.  The thought of virtualizing FreeNAS didn’t occur to me but it’s actually a great idea so I decided to give it a try.  It turns out that FreeNAS actually runs pretty good on VirtualBox.

VirtualBox is a virtualization package developed by Oracle, it’s similar to VMWare except VirtualBox is open source which is a big advantage.

 

FreeNAS 8 running on VirtualBox

 

 

 

 

 

 

 

 

 

 

I tested the following versions of FreeNAS on VirtualBox version 4.0.6.

FreeNAS-8.0-RELEASE-i386
FreeNAS-8.0-RELEASE-amd64

Installation Process

VirtuaBox is very easy to set up, just download the installer and run through the wizard.  To create a new virtual machine click the ‘new’ button in VirtualBox, this will start the new machine wizard.  The first step is to set the OS type and version.  Select BSD as the type and select either FreeBSD, or FreeBSD (64 bit) if you are using the amd64 version of FreeNAS.

 

 

 

 

 

 

 

On the next screen you can set the amount of RAM the virtual machine will be allowed to access.  FreeNAS itself does not have a minimum requirement although I wouldn’t use any less than 1GB.  If you plan to use ZFS you will need at least 4GB since it is a very resource intensive filesystem.

 

 

 

 

 

 

 

 

After you assign the RAM you will need to configure the virtual hard disk.  For FreeNAS you will need at least two virtual disks, one will be the boot drive containing the OS and the second one for data storage.  Make sure ‘Boot Hard Disk’ is selected, choose ‘create new disk’, then click next to start the new disk wizard.  You can create the second hard disk later in the process so don’t worry about it now.

 

 

 

 

 

 

 

VirtualBox allows you to choose between dynamically expanding or fixed-size storage.  I would recomend choosing dynamically expanding, this will create a small file that can grow over time depending on the amount of space required.  If you chose fixed-size VirtualBox will allocate a file of the size you selected and it will not be able to grow.

Even if you choose dynamic you will have to select a size for the disk.  The size you select is the size that will be reported to the operating system.  The FreeNAS installer needs to see that there is enough space available to perform the install so I chose 2GB.

 

 

 

 

 

 

 

The easiest way to install FreeNAS on your new VirtualBox is by mounting the ISO using Daemon Tools, this saves you the trouble of having to burn a CD.  After you have downloaded the FreeNAS iso and mounted it using daemon tools you can boot up your VirtualBox machine.

The first time you start a machine in VirtualBox it will start the first boot wizard.  Select the drive letter assigned to the CD containing FreeNAS or the ISO you mounted using Daemon Tools

 

 

 

 

 

 

 

As soon as you finish the first boot wizard your virtual machine will start up.  If you pointed it to the correct boot drive you should see the FreeNAS boot screen.  At this point you can proceed with installing FreeNAS.

 

 

 

 

 

 

 

 

Instead of rebooting after the installation power down the virtual machine so you can modify a few of the settings.  You can turn it off by selecting the close option from the machine menu.  At this time you should also unmount the installation media otherwise when you boot the virtual machine it will try to begin the installation process again.

Click on the devices menu, then under CD/DVD devices uncheck the box next to the drive you used.  If the drive is still in use you may have to force the unmount of the drive.

 

 

 

 

 

 

 

 

 

 

Network Configuration

By default VirtualBox will attach the network adapter of the virtual machine to a NAT adapter.  I prefer to bridge the adapter directly to the host machines adapter, this way the virtual machine can connect to your local network just like any other machine would.

To change the network settings select your virtual machine on the main screen and click on settings.  On the network tab select bridged adapter from the drop down box where it says ‘attached to’.

 

 

 

 

 

 

 

 

 

Adding an additional virtual drive for storage

While your VM is still powered down you should add an additional virtual disk for FreeNAS to use for data storage.  To do this select the storage tab on the settings page and click the plus symbol at the bottom of the storage tree, then select ‘add hard disk’.  This will once again start the new disk wizard you used earlier.

I created a 100GB dynamic disk for my test, but you can create as many drives with whatever sizes you need.

 

 

 

 

 

 

 

 

 

Booting FreeNAS

At this point all of the configuration you need is in place and you can boot FreeNAS.  To start the VM select it from the main screen in VirtualBox and click start.  FreeNAS should automatically obtain an IP via DHCP which will allow you to access it using the web interface.

FreeNAS should detect the new virtual disk that you created, to confirm try to create a new volume and see if it shows up.

 

 

 

 

 

 

 

 


I’ll probably use this method to test new releases of FreeNAS without having to upgrade my primary NAS.  You could actually run several FreeNAS systems on one physical machine using VirtualBox but it would take a multi-core CPU and a lot of RAM to do. 

Sam Kear

Sam graduated from the University of Missouri - Kansas City with a bachelors degree in Information Technology. Currently he works as a network analyst for an algorithmic trading firm. Sam enjoys the challenge of troubleshooting complex problems and is constantly experimenting with new technologies.

6 thoughts on “Installing FreeNAS on VirtualBox

  1. Thanks Collin! FreeNAS does support external drives so you shouldn’t have a problem getting it working. This will erase the data on the external drive so be careful!

    If you are running it through VirtualBox you’ll need to click on the device menu of the VM and go to USB devices and make sure the external drive is selected. This will disconnect it from Windows and attach it to the VM.

    From withing FreeNAS when you add a new Volume you should see the USB drive in the list of member disks.

    There are a few guides floating around Google that talk about how to mount a usb drive formatted with NTFS is that is what you are looking to do. That might be a useful option if the drive already has data on it.

  2. I would recommend mounting the ISO directly with VirtualBox instead of using DaemonTools. VirtualBox can boot directly from an ISO you pick for the CDROM.

  3. Tried this. While the FreeNAS guest appears to run very smoothly, the guest Network performance is horrible! Can’t even stream a movie to the host without hiccups everywhere.

    host: quad core i7, 16GB RAM, Gigabit Ethernet
    guest: 8GB RAM, ethernet supposedly connects @ 1000 Mb/s
    Disk io is good — scrub of ZFS takes same amount of time as when this system was on dedicated hardware.

  4. @Aaron. I’ve just done this and use it as my actual NAS on my home network (have two virtual machines for different things running on the same box which I also often use as a quick desktop when I haven’t got my laptop to hand). I’m using Ubuntu Desktop 10.04 LTS (I only stick with their LTS releases for things like this though always use their latest on my laptop) and its only a dual core with 8GBs of RAM. I can stream everything to my PS3 fine though maybe it’s because each VM has its own ethernet NIC connected to an OpenWRT router with QoS. I’ve also helped others set up similar servers for other purposes and streaming to their Xboxs but always used dedicated NICs.

    @Sam. I was going to write an article on this after helping a few friends do the same thing though on Linux and with the VM starting up after the host system has automatically to make life easier after after power loss events and scheduled reboots. Instead I’ll link to yours if that’s okay and just write a post on the necessary Linux scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *