As stated on official page for FreeNAS (11.2), it is absolutely supported to virtualize this software on some virtualization platforms. Here is quote from their support site:
When developing FreeNAS we run it as a VM. Our virtualization platform of choice is VMware, and it’s the platform in which the FreeNAS developers have the most experience. FreeNAS includes VMware tools as well. Our second choice for a virtualization platform is Citrix XenServer. FreeNAS has no tools built in for XenServer, but you get a solid virtualization experience nonetheless. Other hypervisors such as bhyve, KVM, and Hyper-V also work, but the development team does not use them on a daily basis.https://www.freenas.org/blog/yes-you-can-virtualize-freenas/
So lets try to do it in Azure. 🙂 There are several steps involved and they are very logical and straight forward. All steps are covered with screenshots so you can try it yourself.
Setting up FreeNAS on local Hyper-V host as virtual machine.
First I created empty 20 GB fixed size VHD file that will be used for FreeNAS virtual machine in my Hyper-V host.
New-VHD -Path d:\FreeNAS-OS-Disk.vhd -Fixed -SizeBytes 20GB
After that, I simply created new Gen1 virtual machine with 2 CPUs and 8 GB of RAM. It for this purpose does not need network connection. Before starting VM, I downloaded and mounted FreeNAS ISO image as boot device.
Screenshot says 4 GB but I changed that to 8 GB of RAM later on and added one more CPU.
After starting virtual machine and booting into installation (option 1 in menu), couple of minutes later and few simple menu screens, FreeNAS was installed. At this point I turned off VM to start with next steps.
Move FreeNAS VHD to Azure storage account
I had two options here and as title suggests, I selected option two. 🙂 Option one was Azure Site Recovery, which I had already setup for some earlier PoC and testing but for some reason it gave me some errors when I tried to replicate FreeNAS VM from local Hyper-V to Azure.
Tool of choice for option 2 is of course Azure Storage Explorer. In Azure I created new storage account and one container in blob storage part for VHD. Upload took less than a minute.
After uploading VHD to Azure Blob storage, we need to convert this VHD to managed disk to be used in new VM in Azure. Go to Disks service and select Add option to add new disk.
Most important part here is to choose VHD that you just uploaded as Source blob for new managed disk. In my case I choose Standard VHD and selected Linux as OS type in a disk.
Uploaded VHD must have vhd extension and must be fixed size or creation will fail.
Create new VM in Azure that boots from FreeNAS VHD
Select newly created managed disk and select option Create VM. Mine is grayed out since I have already done that.
Make sure you select Azure VM with at least 8 GB of RAM and 2 CPU cores. After creation, VM will boot up.
Post VM creation configuration
Go to your virtual machine and select Boot diagnostics option, you should see something similar to this:
Make sure to open required ports to your Azure VM (22 and 80 or 443).
If everything went as expected, when connecting to VMs public IP you should see login screen. Enter your credentials that you created during initial configuration and login to your FreeNAS on Azure appliance. 🙂
FreeNAS uses FreeBSD as core operating system, and it is available and supported in Azure. This setup can be used in testing environments and for PoC purposes. FreeNAS development team has some caveats when virtualizing FreeNAS in any way due to possible issues with ZFS.
If best practices and recommendations for running FreeNAS under virtualization are followed, FreeNAS and virtualization can be smooth sailing. However, failure to adhere to the recommendations and best practices below can result in catastrophic loss of your ZFS pool (and/or data) without warning.https://www.freenas.org/blog/yes-you-can-virtualize-freenas/