VMware Cloud Community
ArunRameswaran
Contributor
Contributor

Resizing VMDK file in vsphere 6.7 for Win 2k16 guest OS.

I wanted to reduce the VMDK file size since Guesst VM has 500GB of unallocated space.

VM configured with single disk and that disk has two primary partitions and an unallocated space 500GB.

I couldn't find proper solutions as Vmware recommended. But there is a way that we can edit descriptor value .VMDK file.

To edit the value use the formula of

New descriptor value

(Total disk size*1024*1024*2)-(Total disk sizet be removed*1024*1024*2)

If we perform above one then on VM edit setting hardisk option is greyed out.

So let me know know is there any best solutions which we can perform and achieve the resizing.

0 Kudos
7 Replies
scott28tt
VMware Employee
VMware Employee

Convert to a new VM with Converter Standalone, resizing the partitions and disks.


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
conyards
Expert
Expert

From the Growing, thinning, and shrinking virtual disks for VMware ESX and ESXi (1002019) KB article VMware Knowledge Base


"Shrinking

  • Virtual disk shrinking is supported when using VMware Converter converting source virtual machine as a machine source (not as virtual to virtual).
    Note: You cannot shrink virtual disks using vmkfstools in ESXi as the hypervisor is not aware of the file system layout and cannot ensure a safe shrink operation.

Before shrinking

  • Migrate the data away from the end of the disk consume to ensure the data is not lost (because the disk area is effectively removed). For example, in Windows GuestOS use Disk Management tool.
  • Shrink the partition residing within a disk before reducing the size of a virtual disk.
  • Non operating system disks users can also add a new smaller VMDK to the virtual machine and copy the data between the larger and new smaller disk using tools within the guest such as Robocopy."

I wouldn’t edit the vmdk descriptors unless you want to spend the next few hours recovering data...

Simon

https://virtual-simon.co.uk/
0 Kudos
continuum
Immortal
Immortal

Unallocated space at the end of a flat.vmdk can be easily cut off with dd.

see vm-sickbay.com for details.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
ArunRameswaran
Contributor
Contributor

this is the solution which I followed initially. But only problem is that under VM edit settings option hardisk section would be greyed out and Incase if we wish increase some space in future on same VM then it would be hard.

Relpying to continuum

0 Kudos
a_p_
Leadership
Leadership

Did you update/reconfigure the .vmdk descriptor file, so that it matches the new data/flat file's size?

André

0 Kudos
ArunRameswaran
Contributor
Contributor

Hello Andre,

Total size of the disk is 800GB and 500GB in that disk is unused so I have shrinked it then it became unallocated space. Now I wanna reclaim that unallocated space back to the datastore.

So I have reconfigured the .VMDK file descriptor value using steps I mentioned in beginning. Post performing this only Harddisk option went greyed out in VM settings.

Performing V2V is also an another option but it is a time consuming process.

Let me know any other possible ways ... without affecting VM data .

0 Kudos
continuum
Immortal
Immortal

did you already read
How to use dd to work with VMDKs stored on VMFS | VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos