Building a NAS – Part 2 – Installing ESXi and FreeNAS

In Part 2 I am going to explain how I installed vmware esxi (free version of esx) and then created a virtual machine for freenas using the disks with raw device mapping, which is like freenas having direct access to the disks

Installing ESXi 5.5

I chose to install esxi on a fast class 10 SDHC 32GB which had roughly 10 MB/sec speed

After the installation of esxi was finished, I installed the VMWare Vsphere Client on a Windows machine and created a virtual machine for the FreeNAS with 8GB hd and 8GB RAM. You have to keep in mind that a lot of memory is needed for the zfs volumes – 8GB is the minimum. My esxi has 16GB RAM and I planning to assign the 12 GB to FreeNAS and the rest to the ubuntu server.

Adding the disks as Raw Device Mapping

I found this very good article on how to mount the disks as Raw Devices to esxi

What you basically do is perform a ls -l inside the directory /dev/disks in order to show all the drives (hd’s) – the drives in my case are the ones that start with t10.ATA_____ST (seagate drives) and with the capacity in front. You can also check the serial numbers of the drives from here

Then you cd inside the directory where the esxi volume is – in my case disk0 (cd /vmfs/volumes/disk0)

And the you run the command vmkfstools -z drive drive_name_given.vmdk

 vmkfstools -z /vmfs/devices/disks/t10.ATA_____ST2000DM0012D1CH164__________________________________Z1E1DSBL rdm_Z1E1DSBL.vmdk

This has created the rdm_Z1E1DSBL.vmdk for the disk /vmfs/devices/disks/t10.ATA_____ST2000DM0012D1CH164__________________________________Z1E1DSBL

So now my raw disk mappings are ready and all I have to do is to add the three drives (HD) from vsphere to FreeNAS. I chose the “Use an existing virtual disk”  as type of disk and then I chose the files that I had created

Now you can see the disks mapped as Mapped Raw LUN to FreeNAS – remember to give different SCSI device node numbers for each one

So now we mount the iso of FreeNAS to the CD drive of the virtual machine and start it

I select to install FreeNAS on my virtual hd that I chose to be 8GB large (no need for a big hd as this is used only by FreeNAS and cannot be used for volumes)

freenas install -1

freenas install -2

Finish the install and reboot

freenas install -3

After reboot I can open my browser and type in the url in order to access FreeNAS

freenas install -4

Logging to FreeNAS and going to Storage -> View Disks you can check my drives mounted as raw devices

Testing FreeNAS zfs volumes from ubuntu

Before copying all my data to the FreeNAS, I wanted to check if my writes were readable from a different system

After I created a volume in FreeNAS I removed the hard drive and installed it in a ubuntu 12.04 server which had the zfs installed. You can install zfs in ubuntu by using

 apt-get install ubuntu-zfs

in order to import the volume you can try

 zpool import volume1

where volume1 was the name of the volume I had created in FreeNAS

Importing the volume in ubuntu and viola! I was able to read the files and directories without any problem

Leave a Reply