NFS datastore on ESXI 5.*

In the blog before this one. I explained how you could create a (software) RAID1 with LVM. This storage is meant to be shared as NFS. One of it’s purposes is NFS datastore on ESXi 5.*. Underneath i will explain how to mount the NFS on the ESXi commandline, but also I will give you a tip how to store your snapshots and vswap files on another datastore than the datastore the VM’s is stored on.

Pre-requisites:
– I assume you have created your own share.
– You have created the proper firewall rules (or disabled it)
– Have esxcli and ssh enabled on the ESXi host.

Step 1: Mounting NFS on ESXi
First ssh into the ESXi host.
The command for mounting the NFS share is relatively easy:

*Note: If you want to remove the nfs share use this command:

* host, can also be the hostname or FQDN as long as your dns is setup correct 😉
* share, is the remote folder
* volume-name, here you can choose the name you want to specify for the mounted NFS share.

If you want to check wether it succeeded or not:

As you can see, the nfsstore was added. I can also see it in my vsphere (web) client:

Step 2: Changing the snapshot and vswap location:
My virtual machines run on a hp server. Which has a raid5 with 10k SAS disks. So for speed and fail security purposes I’d like to have the vm files on there. However snapshots could be stored on the nfs store. I found this addition that makes the above possible.

First go to your vsphere client and download the .vmx file of your VM (make sure it is down!)
Next open the .vmx with a tool like notepad++. Add the rules beneath and enter the correct collection of your storage folder. (Please don’t forget to upload the .vmx file to the datastore). I’d like to recommend you create folders per vm, else all snashots will be in the same folder.

IMPORTANT: Please make sure you create the folders manual on forehand. Else the VM will NOT start!

Now start the VM and create a snapshot to test if it’s working!

As you can see the snapshot was created and written to the nfs share! This will save me alot of space on the standard datastore.

Leave a Reply

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