VMware Cloud Community
mla579
Enthusiast
Enthusiast
Jump to solution

resize (shrink) vmdk

Hi,

I converted a VM from Hyper-V to vSphere. To eliminate any surprises during conversion of this critical machine I didn't want to resize huge 😧 partition that was initially 400GB. The only thing I adjusted was provisioning that I set to Thin. It is fine for this machine (no intensive activity).

The actual Data on partition is 40GB (over 2 years). So I shrinked the partition to 100GB within Windows DISKMGMT.

So I have 100GB partition on 400GB vmdk with Thin provisioning.

The questions:

1. Is there a way to resize the above vmdk to partition size without shutting down the server?

I guess not...

2. What will be the best (secure) way to proceed?

3. Is it correct that if current 400GB is on Thin provisioned vmdk the data store usage is equal to only actual VM(vmdk's and config) size?

If the above is correct there is probably no need to resize vmdk because this VM will never use more than defined Windows partitions. Right?

Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
MKguy
Virtuoso
Virtuoso
Jump to solution

1. Is there a way to resize the above vmdk to partition size without shutting down the server?

You can't shrink VMDKs, whether live or cold, only extend them.

2. What will be the best (secure) way to proceed?

The cleanest and simplest way would be: Attach a new disk to the VM, migrate your data, unmount the old disk from the guest OS, remove the old disk.

3. Is it correct that if current 400GB is on Thin provisioned vmdk the data store usage is equal to only actual VM(vmdk's and config) size? If the above is correct there is probably no need to resize vmdk because this VM will never use more than defined Windows partitions. Right?

A thin-provisioned disk grows in size if a block is written to for the first time. If you decreased the partition size in the guest OS, then under normal circumstances writes should never take place on this unpartitioned space. However, blocks that have been written to in the past will remain and continue to occupy physical disk space on the datastore (unless you write binary zeros to that space and svMotion the VM or similar).

-- http://alpacapowered.wordpress.com

View solution in original post

Reply
0 Kudos
8 Replies
MKguy
Virtuoso
Virtuoso
Jump to solution

1. Is there a way to resize the above vmdk to partition size without shutting down the server?

You can't shrink VMDKs, whether live or cold, only extend them.

2. What will be the best (secure) way to proceed?

The cleanest and simplest way would be: Attach a new disk to the VM, migrate your data, unmount the old disk from the guest OS, remove the old disk.

3. Is it correct that if current 400GB is on Thin provisioned vmdk the data store usage is equal to only actual VM(vmdk's and config) size? If the above is correct there is probably no need to resize vmdk because this VM will never use more than defined Windows partitions. Right?

A thin-provisioned disk grows in size if a block is written to for the first time. If you decreased the partition size in the guest OS, then under normal circumstances writes should never take place on this unpartitioned space. However, blocks that have been written to in the past will remain and continue to occupy physical disk space on the datastore (unless you write binary zeros to that space and svMotion the VM or similar).

-- http://alpacapowered.wordpress.com
Reply
0 Kudos
mla579
Enthusiast
Enthusiast
Jump to solution

Thanks !

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

You could shrink the disk size by using the VMware converter.That would be the best way to shrink a disk. you could alos try vmkfstools i but its not the recommended way.

Reply
0 Kudos
mla579
Enthusiast
Enthusiast
Jump to solution

Now I have kind of 2 best options.

The server that I am talking about is SQL and is critical VM.

When I converted this VM from Hyper-V I could resize future vmdk but when I tried to change the size it showed new size in red-yellow with notification that block level will be changed to file level.

So to eliminate any possible failure I left original partition size and just put Thin provisioning.

Now if I will try to convert this 400GB vmdk I will have probably the same kind of warning.

Is it "dangerous"?

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

VMware converter is designed for such situations. and best part you can do it on the fly with having your actual VM running thereby reducing the downtime.Now when your using the VMware converter it actaully clones the disk into a new disk with a lesser size at the destination, So there by your original Disk is not touched and safe.

Thanks,
Avinash

MKguy
Virtuoso
Virtuoso
Jump to solution

A File level conversion is not "dangerous", but it can be slower especially with lots of small files.

But I honestly wouldn't recommend hot-converting a transactional service like a SQL database. Ideally the SQL services should be stopped during conversion.

Also you will certainly incur some downtime at least for the switchover from the original to the cloned new instance.

-- http://alpacapowered.wordpress.com
mla579
Enthusiast
Enthusiast
Jump to solution

Thanks to both...

So I will use the conversion way and I will stop SQL services (I did the same before conversion from Hyper-V).

Anyway maintenance window will be scheduled.

For a test purpose I tried to convert Test Server 2008 with shrinked partition 😧 that sits on the same Data Store where is my Production server.

I get the error message: The destination VM  abcxxx is already exist.

And it's clear why. I do the operation on the same cluster... What should I do in order to solve this?

I see that I can create a new folder on DataCenter level. Would it be a solution?

Reply
0 Kudos
alatariel
Contributor
Contributor
Jump to solution

i use the converter, and never have problems,except one day when i started the shrink VM, the resolution of sreen have change, and the mouse was slowwww.

i solved the situation, reinstalling the vmware tools, and everything was ok again.

its not the answer to your question, but i think it can be usefull , in case that you use the vmware converter.

🙂

Reply
0 Kudos