vCenter 4 - Shrink disks

I need to recapture some space on a Windows 2008 VM in vCenter 4. The VM has a few hundred GB free and I need to try to get that back.

I see that in vCenter I can edit the disk size. Will that actually reduce the size of the client partition and reduce the size of the vdmk?

If not, what's the fastest (and safest) way to do this? I need the space like yesterday.

Thanks!
LVL 1
willp2Asked:
Who is Participating?
 
larry urbanConnect With a Mentor DevOps EngineerCommented:
If you have a license that supports Vmotion, you can migrate the VM to another host and during the migration dialogue select "Thin" as the disk type. this will have your ESX(i) server manage the disk size and allocate less disk space for the VM. It will give you back most of your wasted space by only allocating the space that is actually being used.

The only other option is to use a 3rd party tool like Gparted and shrink the disk partition of the OS, then add a second disk to the VM, the size of the now shrunk partition. Boot to a ghost disk,  Ghost it to a VM with a smaller partition to the new smaller disk. Remove the first disk. (just remove don't delete until you have everything working on the new disk)
0
 
Danny McDanielClinical Systems AnalystCommented:
You won't be able to shrink the disk within the vsphere client...only increase it.  It's because the client/ESX won't operate within the VM to change the partition size(s).

Your best/safest bet is to use converter and tell it to treat the VM like a physical system.  Then you can set the disk sizes as needed and leave the VM running while it does it's copying of files over to a new VM.  Downside is that you'll need all of the space of the new vm plus the old one until you can switch over to the new, smaller VM.
0
 
Paul SolovyovskySenior IT AdvisorCommented:
I agree with the VMWare Converter method
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
coolsport00Commented:
You can use vCenter Converter Standalone (or converter within vCenter):
http://downloads.vmware.com/d/info/datacenter_downloads/vmware_vcenter_converter_standalone/4_0, or you can power down the VM, change the disk size to what you want it, then resize it in disk mgmt (since it's a W2K8 VM)

Regards,
~coolsport00
0
 
willp2Author Commented:
Are you saying I can just power down the VM, resize in vCenter then power back up and Windows will have less space and wont have its partitions hosed? Will that also shrink the vdmk?

Also on the converter method, I don't think I actually have the space to make a new vdmk (that's why I am trying to reclaim some space). So this might be tough.
0
 
Danny McDanielClinical Systems AnalystCommented:
I think coolsport00 is confused about what we're talking about...  He may be thinking about increasing the size of disk???

I just verified with ESXi/vCenter 4.1 and windows 2008 guest that you can only increase a disk's size with the client.

If you're limited on space and you can afford downtime, you could use Converter to export the VM to VMware Workstation format and put it out on a Windows share, then erase the original VM, then bring it back with converter.  The only thing I'm not certain about is if you can resize it with Converter when pointing it to the Workstation files or if you would have to power it up using VMware Player and do another "physical" conversion.  Just start the conversion without deleting the original vm to make sure you have the option to resize volumes.

If you are backing up the system using a Converter supported format(like Backup Exec System Recovery), then you could just use Converter to re-create the VM from that image, too.
0
 
coolsport00Commented:
Ooops...yes, I did misread; thanks "danm66". To decrease, you can modify the virtual disk then use a 3rd party product, as "todar" mentions, like GParted (http://gparted.sourceforge.net/download.php) or Paragon, etc. VMware has a KB on Increasing disk size and 3rd party tools you can use to do so for system volumes. You can use any of those to modify the volume for decreasing size as well:
http://kb.vmware.com/kb/1004071

~coolsport00
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Just be very careful with gparted, the latest version appears to be "broken" when it comes to altering NTFS disk partitio sizes. Be Warned! (and have a backup!)
0
 
coolsport00Connect With a Mentor Commented:
Another option you have is to power down this VM, remove the virtual disk (*BUT DO NOT DELETE IT FROM DISK*), then attach it to a 2nd VM. Power down the 2nd VM, resize the virtual disk, power on the 2nd VM, then use diskpart to resize the partition. Power down the 2nd VM and remove the virtual disk (again, *DO NOT DELETE IT FROM DISK*), then re-add it to the orig VM and power it on.

~coolsport00
0
 
willp2Author Commented:
Sorry I guess I'm confused a bit here. Why can't I just use the Windows server built in shrink function to shrink the Windows partition?
0
 
coolsport00Commented:
Yes, by all means, make a copy of your virtual disk as "hanccocka' suggests. If you have little to no space on your datastore to do so, download Veeam FastSCP and install on your workstation. Connect a device that has enough space, if your local drive or another ntwk drive doesn't have enough space, and copy the virtual disk to that location. You have to power down your VM to make the copy.

~coolsport00
0
 
coolsport00Commented:
Hmm...ok, according to here:
http://technet.microsoft.com/en-us/library/cc731894.aspx,
and here:
http://www.petri.co.il/shrinking-a-partition-in-windows-vista-or-server-2008.htm, you can. You can try it (I haven't). But, again, as mentioned, make a b/u of your virt disk before doing so.

~coolsport00
0
 
coolsport00Commented:
So, what you would do to try this is first make a backup/copy, power down the VM, resize the disk, power it on, then use the MS/Petri articles to shrink your partition.

~coolsport00
0
 
coolsport00Commented:
Although, in re-looking at the MS KB, it says the version of 2K8 is R2. "danm66"...you said you attempted it and it didn't work? What 2K8 version do you have?

~coolsport00
0
 
willp2Author Commented:
Well it turns out the disk does not contain the system parition, it's just a file store.

So if I can come up with enough space, I should be able to add another disk to the VM, transfer everything to that and delete the old disk without any conversions or anything, right?
0
 
willp2Author Commented:
All that said, just to confirm yet again, vCenter won't shrink the vdmk even if the VM isn't using the space right? Funny that they let you go though the motions though.
0
 
coolsport00Commented:
Oh, well then you have even more options. If it's a secondary drive, you should be able to power down the VM, resize the disk, power it up, then use diskpart to modify the partition. But, if you have enough datastore storage to create another virt disk, then sure...create it, attach it to the VM, then do a simple copy of your data to the other virtu disk. Once complete and verified all files are there, you can delete the orig virt disk. Or, if you have a backup of your data (Symantec Backup Exec, Avamar, etc.), you can simply do a restore of your data to the new disk. You have several options...

~coolsport00

p.s. Yes, vCenter doesn't provide the means to solely reduce the disk size and then the space is reclaimed, thus why I presented the KB above (is the same for both increase and decreasing virt disks).
0
 
orneredConnect With a Mentor Commented:
I increase/decrease vm disks this way
1.      Defrag the disk and then power off the VM
2.      Edit the Settings for the VM (select the VM in the VI client and choose Edit Settings from the Summary tab, or right click menu lets you edit the settings too)
3.      Select the virtual disk you want to increase/decrease. A new field will be added under Capacity called New Size,
4.      Enter a new value that is larger/smaller then the current value.
5.      Configure the VM to boot from the GParted LiveCD or the partition tool CD of your choice.
(I use the "systemrescue 1.5.6" cd)
6.      Expand/decrease the VM’s disk partition
7.      Reboot the VM to it’s normal OS - if it’s a Winodws VM you will have to wait for a chkdsk to finish and another reboot and one reboot in widows after that.
Done it many times without problem
I hope it was some help:)
0
 
prak_seafarerCommented:
you can use the vcenter convertor by importing the vm. you need to select the thin provisioning option for storage disk. this way the data will be analysed and then 125% of the used disk will be provisioned.
0
 
willp2Author Commented:
One thing I'm running into is that the VM has disks on different storage devices. So the system is on one NAS and the file share is on another as an example. I think running through the converter will put everything in place, right? So all the vdmk's will end up in the same place instead of on the different devices. I won't get into why it's setup that way, just that it would be awkward to relocate everything onto one device.
0
 
coolsport00Commented:
Well, you have been given some options to 'not' have to use Converter. You just have to choose what works best for you...

Regards,
~coolsport00
0
 
willp2Author Commented:
Thanks I do realize that I'm just trying to work through the issue. I was able to stall until the weekend so I at least have a bit of time now to make this happen.

I have resized the Windows partition down to the size I need, and not need to work on shrinking the vdmk
0
 
coolsport00Commented:
Ok...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.