This lesson will show you how to convert your thick provisioned disks to thin on a VMWare ESXi 5.x server. We can’t really ‘convert’ the current thick disk to a thin disk but we’ll have to use the CLI to copy the thick disk to a new thin provisioned disk and then remove the old thick disk. First connect to your ESXi server using SSH. If you can’t connect you first have to enable SSH for ESXi.
# ssh firstname.lastname@example.org Password: ******* The time and date of this login have been sent to the system logs. VMware offers supported, powerful system administration tools. Please see www.vmware.com/go/sysadmintools for details. The ESXi Shell can be disabled by an administrative user. See the vSphere Security documentation for more information. ~ #
Now open the /vmfs/volumes folder. This is where your datastores are located.
# cd /vmfs/volumes/
Below you can see my datastores. I have one called “300GB” and another one called “600GB”.
/vmfs/volumes # ls -lh drwxr-xr-x 1 root root 8 Jan 1 1970 055a4be9-820caa11-7809-566310453092 drwxr-xr-x 1 root root 8 Jan 1 1970 05d029e0-8b8124ba-3b8b-530156dbed60 lrwxr-xr-x 1 root root 35 Jun 29 15:50 300GB -> 51bb0fe7-4c18ef90-56e5-d89d671759bc drwxr-xr-x 1 root root 8 Jan 1 1970 51bb09f1-14305db8-93cb-d89d671759bc drwxr-xr-t 1 root root 1.9K Jun 29 15:49 51bb0fd3-bd5f8cac-dda9-d89d671759bc drwxr-xr-t 1 root root 1.4K Jun 27 09:06 51bb0fe7-4c18ef90-56e5-d89d671759bc lrwxr-xr-x 1 root root 35 Jun 29 15:50 600GB -> 51bb0fd3-bd5f8cac-dda9-d89d671759bc
Open the datastore where your virtual machine is located and open the folder of the virtual machine. You can see my MMVOIP01_1-flat.vmdk file which is 232.4G. This is a linux server running Asterisk that in reality only uses about 4G.
# cd 300GB/MMVOIP01/ # ls -lh -rw------- 1 root root 31.8K Jun 29 15:50 MMVOIP01-ctk.vmdk -rw------- 1 root root 501.1M Jun 29 15:50 MMVOIP01-flat.vmdk -rw------- 1 root root 8.5K Jun 29 15:50 MMVOIP01.nvram -rw------- 1 root root 649 Jun 29 15:50 MMVOIP01.vmdk -rw-r--r-- 1 root root 44 Jun 28 23:00 MMVOIP01.vmsd -rwxr-xr-x 1 root root 2.9K Jun 29 15:50 MMVOIP01.vmx -rw-r--r-- 1 root root 3.3K Jun 27 10:47 MMVOIP01.vmxf -rw------- 1 root root 7.3M Jun 29 15:50 MMVOIP01_1-ctk.vmdk -rw------- 1 root root 232.4G Jun 29 15:50 MMVOIP01_1-flat.vmdk -rw------- 1 root root 661 Jun 28 23:00 MMVOIP01_1.vmdk -rw-r--r-- 1 root root 136.3K Jun 14 13:49 vmware-1.log -rw-r--r-- 1 root root 34.2K Jun 14 13:50 vmware-2.log -rw-r--r-- 1 root root 211.4K Jun 14 15:31 vmware-3.log -rw-r--r-- 1 root root 1011.5K Jun 29 15:50 vmware.log
We can copy the current thick provisioned disk image to a new file that is thin provisioned using the vmkfstools command. In my case I’m creating a new file called MMVOIP01THIN.vmdk that is thin provisioned.
# vmkfstools -i MMVOIP01_1-flat.vmdk -d thin MMVOIP01THIN.vmdk Destination disk format: VMFS thin-provisioned Cloning disk 'MMVOIP01_1-flat.vmdk'... Clone: 21% done.
Once it’s done we only have to remove the old ‘thick’ vmdk file and rename the new ‘thin’ vmdk file to the old filename. You can also use the GUI to remove the old harddisk from the virtual machine and add the new drive.
# rm MMVOIP01_1-flat.vmdk # mv MMVOIP01THIN.vmdk MMVOIP01_1-flat.vmdk
Now start your virtual machine and it will have a thin provisioned disk! That’s all there is to it. If you have any questions just leave a comment in our forum!
This worked like a charm thanks!
One note though; to delete the old hard disk you prob have to delete all previous snapshots, I had to.
vmkfstools -K /vmfs/volumes/pathto/thickdisk.vmdk also should do this in place conversion. Would you like to give a try and update ?
I’ll give it a try.
Hi, why is it that i get this error when i enter the vmkfstools command?
DiskLib_Check() failed for source disk The system cannot find the file specified (25).
Your example is using the *-flat.vmdk file as the source which I think is wrong. It should be using the other *.vmdk file.
Its just my 2 cents. Maybe it worked in your machine.