I recently virtualized my desktop PC’s windows 7 ultimate over to my ESXi host using VMware vConverter Tool. During the conversion process, the VMDK for the OS was created as a 175GB thick vmdk hard disk file as my C:\ was of the same size.
I have space constraints on ESXi host, therefore I shall change the vmdk provisioning from thick to thin to conserve some space. This can be done easily through the ESXi SSH CLI, however, I don’t have sufficient drive space on my host to get this this conversion done.
I would need to mount a NFS share on ESXi, add it as a datastore and carry out the procedure. The actual NFS directory will be served from another PC that I have on LAN and which has plenty of storage available.
My desktop OS is Windows 7 ultimate which doesn’t have any NFS server built-in. So, I would be using a CYGWIN installation to stand up a temporary NFS share for ESXi use.
Step 1
Install CYGWIN on windows OS – https://cygwin.com. I used setup-x86_64.exe (64-bit installation). Default install is fine but do remember to install cygrunsrv, nano editor and unfsd server packages during the install. unfsd supports NFSv3 specification.
After install, start the CYGWIN console as administrator. Your local drives should be auto mounted and ready to use under /cygdrive/
$ ls /cygdrive/
c d e f h i l m n
Configure NFS server, give it a username/password to run the daemon under.
$ /usr/sbin/unfsd-config
It prompts me to add a Guest user, so…
$ mkpasswd.exe -l -u Guest >> /etc/passwd
To make sure everything looks good
$ cat /etc/passwd
# Edit configuration files
$ nano /etc/exports
# Export the entire Cygwin filesystem to all (0.0.0.0) machines
# In addition to write access, all uid squashing is
# turned off for hosts.
/ (rw,no_root_squash)
Edit hosts.allow file to allow incoming requests from ESXi subnet. I added both service names as I was not sure which to use.
$ cat /etc/hosts.allow
unfsd: 192.168.1.0/255.255.255.0
nfsd: 192.168.1.0/255.255.255.0
We need to restart the services for changes to take effect. You might want to look at logs while restarting services to any catch any errors upfront.
$ tail -f /var/log/unfsd.log
$ tail -f /var/log/mountd.log
$ tail -f /var/log/rpcbind.log
On windows OS, run services.msc and look for services starting with “Cygwin”. Restart them, if they give any error then just reboot your OS, they should auto start next time you boot your windows.
Cygwin mountd
Cygwin unfsd
Cygwin portmap
NFS server part is good to go, now onto ESXi.
Step 2
Log in web gui of ESXi and open ports for NFS in ESXi firewall. This is under Networking > Firewall > NFS Client > Edit > enter the LAN subnet like 192.168.1.0 or a specific IP address (i.e. of your NFS Server).

Once this is done, hop on to ESXi Storage section > add new datastore > NFS. On the next screen give the server details. Under path, give complete path to your shared directory on the server. In my case, I have a empty folder “nfs” created on my H:/ drive, hence, /cygdrive/h/nfs.
Step 3
After the NFS share is mounted on ESXi, drop to a ESXi SSH CLI.
[root@esxi:/vmfs/volumes/X] vmkfstools -i PCVM.vmdk -d thin /vmfs/volumes/nfs/PCVM.vmdk
There would be a -flat.vmdk file, for conversion you shouldn’t use the -flat file. It works when you execute the command on the correct file without the -flat filename as shown above. if you tried with -flat, you’d get an error.
DiskLib_Check() failed for source disk The file specified is not a virtual disk (15).
Tags: Disk Lab VMware