I was playing around in my lab with NFS datastores today. I wanted to fail-over a replicated NFS datastore without the need to re-register the virtual machines running on them. I had mounted the NFS datastore using the IP address and as that is used to create the UUID it was obvious that it wouldn’t work. I figured there should be a way around it but after a quick search on the internet I still hadn’t found anything yet.
I figured it should be possible to achieve this using a CNAME but also recalled something around vCenter screwing this up again. I tested it anyway and with success. This is what I did:
- Added both NFS servers to DNS
- Create a CNAME (DNS Alias) and pointed to the “active” NFS server
- I used the name “nasdr” to make it obvious what it is used for
- Created an NFS share (drtest) on the NFS server
- Mount the NFS export using vCenter or though the CLI
- esxcfg-nas -a -o nasdr -s /drtest drtest
- Check the UUID using vCenter or through the CLI
- ls -lah /vmfs/volumes
- example output:
lrwxr-xr-x 1 root root 17 Feb 6 10:56 drtest -> e9f77a89-7b01e9fd - Created a virtual machine on the nfsdatastore
- Enabled replication to my “standby” NFS server
- I killed my “active” NFS server environment (after validating it had completed replication)
- Changed the CNAME to point to the secondary NFS server
- Unmounted the volume old volume
- esxcfg-nas -d drtest
- I did a vmkping to “nasdr” just to validate the destination IP had changed
- Rescanned my storage using “esxcfg-rescan -A”
- Mounted the new volume
- esxcfg-nas -a -o nasdr -s /drtest drtest
- Checked the UUID using the CLI
- ls -lah /vmfs/volumes
- example output:
lrwxr-xr-x 1 root root 17 Feb 6 13:09 drtest -> e9f77a89-7b01e9fd - Powered on the virtual machine now running on the secondary NFS server
As you can see, both volumes had the exact same UUID. After the fail-over I could power-on the virtual machine. No need to re-register the virtual machines within vCenter first. Before I wanted to share it with the world I reached out to my friends at NetApp. Vaughn Stewart connected me with Peter Learmonth who validated my findings and actually pointed me to a blog article he wrote about this topic. I suggest to head-over to Peter’s article for more details on this.





