In my earlier FreeNAS post I talked about my use of VirtualBox (VB) and thought it might be useful to do a ‘How to…’ type blog showing show to create a VB jail and get a Virtual Machine (VM) up and running. It’s really not that difficult, I promise!
FreeNAS 9.3.1 only has 2 jail templates, for a standard FreeBSD jail or a VirtualBox 4.3.12 jail.
In the Jails section, simply click the Add jail button and complete the required options, namely Jail Name, Template (from the drop-down) and the appropriate IP address. Everything else can be left blank.
Once you click OK, a VB jail will be created where you can then access the Control Panel at the IP address on your local network from any browser (the default login in Admin for both Username and Password, although I’d recommend changing them in the File menu as one of your first tasks!)
It’s that simple to create a VB jail, but it’s not much use without adding some VMs! For that you’ll need to download an .ISO files for whatever OS you want to use, and store it somewhere on your FreeNAS machine. I have a dataset called ‘VM’ for storing all the VMs I create and also a dataset called ‘temp’ with a folder inside called VM where I store all the .ISO files. How you do this is entirely up to you, but the following assumes a similar set-up to me. For info, my zpool is called APEpool1.
You’ll need to go to the Jails screen, click the Storage tab and then Add Storage. I created the 2 following mount points in my vm5 VB jail:
It’s then just a case of creating the new VM:
- Click the New button
- Enter a name and select the OS type from the drop-downs (I’d avoid using spaces)
- Allocate some RAM, again depending on your OS and use-case. Unless you’re running a lightweight OS, the default 512MB probably isn’t enough, although it can be changed later
- Create a virtual hard disk drive (VDI is fine if just using in VB)
- Dynamically allocated or Fixed size depends again on your use-case, but Fixed size can be increased later, although it’s a little messy
- Allocate some space for the virtual drive
Your VM is now created, and you can adjust any of the settings from the Settings button, or by clicking each section in the right-hand window.
To boot with a .ISO file you’ve downloaded, you first need to add this as virtual CD using the Storage settings.
- Click Settings and then select Storage in the left-hand window
- Click the Add CD icon (small circle with a +) for either the SATA or IDE controller (not sure it makes any difference, although I tend to use the IDE one)
- Click Choose disk, and then navigate to where you’ve saved your .ISO file (if you remember from above, I’d mounted a temp dataset on FreeNAS to the jail in the temp folder)
- Find the correct .ISO file and then click OK
- Remove any Empty devices (click them and then click the blue square with a – icon) then click OK
Now you can start the VM (yep, you guessed it, click the Start button), connect to it using a remote console application like RealVNC, Screen Sharing, etc., and then following the OS installation instructions.
Once you’ve installed things to your virtual hard disk, it’s probably a good idea to stop the VM and remove the virtual CD, so the next time you start the VM it boots from the virtual hard disk and not the .ISO file again.
Having the ability to run guest VMs in FreeNAS really is incredibly useful, and one of the main reasons I’ll be sticking with 9.3.1 for the foreseeable future. You can do a lot in a standard FreeNAS/FreeBSD jail, but you’ll need to feel comfortable with the command line, whilst with VB most things can be presented graphical, if required.
If you happen to stumble upon this, I hope it’s if some use, but if not please let me know why and I’ll try to update…