Solved

vCenter 4 - Shrink disks

Posted on 2011-03-09
23
2,591 Views
Last Modified: 2012-06-27
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!
0
Comment
Question by:willp2
  • 10
  • 6
  • 2
  • +5
23 Comments
 
LVL 16

Expert Comment

by:danm66
ID: 35088649
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
 
LVL 42

Expert Comment

by:paulsolov
ID: 35088659
I agree with the VMWare Converter method
0
 
LVL 40

Expert Comment

by:coolsport00
ID: 35088674
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
 
LVL 1

Author Comment

by:willp2
ID: 35088733
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
 
LVL 16

Expert Comment

by:danm66
ID: 35088950
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
 
LVL 7

Accepted Solution

by:
Todar earned 167 total points
ID: 35089054
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35089126
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
 
LVL 118
ID: 35089154
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
 
LVL 40

Assisted Solution

by:coolsport00
coolsport00 earned 167 total points
ID: 35089172
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
 
LVL 1

Author Comment

by:willp2
ID: 35089221
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35089225
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 40

Expert Comment

by:coolsport00
ID: 35089245
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35089253
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35089267
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
 
LVL 1

Author Comment

by:willp2
ID: 35089399
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
 
LVL 1

Author Comment

by:willp2
ID: 35089409
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35089447
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
 
LVL 2

Assisted Solution

by:ornered
ornered earned 166 total points
ID: 35091993
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
 
LVL 3

Expert Comment

by:prak_seafarer
ID: 35115732
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
 
LVL 1

Author Comment

by:willp2
ID: 35117333
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35117346
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
 
LVL 1

Author Comment

by:willp2
ID: 35117394
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
 
LVL 40

Expert Comment

by:coolsport00
ID: 35117461
Ok...
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Advanced tutorial on how to run the esxtop command to capture a batch file in csv format in order to export the file and use it for performance analysis. He demonstrates how to download the file using a vSphere web client (or vSphere client) and exp…
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now