VMware {code} Community
vohra
Contributor
Contributor

How to read only the used portion of a thin virtual disk.

Hi

I have a virtual machine which has a thin provisioned virtual disk (total allocated size is 8GB and consumed size is 2 GB). When

I browse the virtual disk using the vSphere Client's datastore browser it rightly shows the virtual disk size as 2 GB. But when I am

reading the disk using VDDK its reading the full 8GB, its a VMFS datastore and I am using the nbd transport mode. I am not sure how

can I read only the actual used virtual disk i.e. 2 GB using VDDK . Any ideas in this direction will be highly appreciated. Thanks.

Reply
0 Kudos
3 Replies
admin
Immortal
Immortal

Hi,

Take a look at the disk change tracking feature - part of vSphere SDK, combined with VixDiskLib functions, you should be able to do what you are asking about.

Thanks

Sudarsan

Reply
0 Kudos
raghuram
Contributor
Contributor

Some what on a related note, would it be possible to backup only allocated portion of the disk even if CBT is not enabled? I am asking this primarily to support VMDKs belonging to pre-vSpehere 4.0 VMs. Even though incrementals are not possible in that case, would it still be possible some how to only back up just allocated data and not entire disk?

Thanks,

Raghu

Reply
0 Kudos
lamw
Community Manager
Community Manager

CBT is a feature of vSphere, if you're trying to do the same pre-vSphere, you'll basically need to keep a bitmap of the blocks that have changed since some point in time, similar to how CBT does it today. You would need to read in the VMDK and keep your own changelist, that is how some of the backup vendors did it prior to CBT where the change blocks were provided from VMware via the APIs.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos