Latest News

Thick Disk to Thin Disk

Tuesday, April 14, 2009 , Posted by Virtualbox at 1:06 AM

I have came across many situations where people asked about thin provisioned disks for their VMs. Sometimes they already have their Thick Provisioned disks and want to convert all those disks to Thin Provisioned. So thought to create this post.

This is the setup I did exclusively for you now on my LAB and below is the output.

I have created a new Thick disk of 2GB using the command line and the output is as below:

[root@virtualbox prasenjit]# vmkfstools -c 2048m -d thick -a lsilogic test.vmdk

[root@virtualbox prasenjit]# ll
total 2097216
-rw------- 1 root root 2147483648 Nov 12 13:49 test-flat.vmdk
-rw------- 1 root root 369 Nov 12 13:49 test.vmdk

Now I did a cat to the vmdk descriptor file and there is no hint of whether it is Thick or Thin. It means that this is a Thick disk.

[root@virtualbox prasenjit]# cat test.vmdk
# Disk DescriptorFile
version=1
CID=1e16e9e2
parentCID=ffffffff
createType="vmfs"

# Extent description
RW 4194304 VMFS "test-flat.vmdk"

# The Disk Data Base
#DDB

ddb.virtualHWVersion = "4"
ddb.uuid = "60 00 C2 99 ab 52 a3 f6-83 3e 7c 91 77 14 15 42"
ddb.geometry.cylinders = "261"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"

Now we have to do a clone of this disk in order to change the disk type and without losing any data on the disk.

[root@virtualbox prasenjit]# vmkfstools -i test.vmdk newfile.vmdk -d thin
Destination disk format: VMFS thin-provisioned
Cloning disk 'test.vmdk'...
Clone: 100% done.

[root@virtualbox prasenjit]# ll
total 4124800
-rw------- 1 root root 2147483648 Nov 12 14:00 newfile-flat.vmdk
-rw------- 1 root root 398 Nov 12 14:00 newfile.vmdk
-rw------- 1 root root 2147483648 Nov 12 13:49 test-flat.vmdk
-rw------- 1 root root 369 Nov 12 13:49 test.vmdk

Now if you can check the descriptor file for the new disk then it will say you that this is a Thin disk.

[root@virtualbox prasenjit]# cat newfile.vmdk
# Disk DescriptorFile
version=1
CID=1e16e9e2
parentCID=ffffffff
createType="vmfs"

# Extent description
RW 4194304 VMFS "newfile-flat.vmdk"

# The Disk Data Base
#DDB

ddb.virtualHWVersion = "4"
ddb.uuid = "60 00 C2 97 84 b4 66 af-ef 29 f9 a9 2c 58 6f cc"
ddb.geometry.cylinders = "261"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
ddb.thinProvisioned = "1"

Currently have 3 comments:

  1. SANJAT KABI says:

    THIS IS GOOD hope more will come

  1. subbu says:

    Very good one.. Thanks

  1. Ruben says:

    Here is an script called makeThin that does the conversion of virtual disks in a clean and precise way, with warnings and review after each conversion, for as many VMs as you want.

    http://vmutils.blogspot.com/2011/06/automatic-thinning-of-virtual-disks.html

    It can also give you a summary of storage savings.

Leave a Reply

Post a Comment