VMware Cloud Community
Tadziz
Contributor
Contributor

[SOLVED] Shrink disk size

Hello,

  I have problem with disk size. accidentally i increased wrong VHD size from 50 GB to 100 GB. As you can see in the image, extra 50 GB still is not is use and i want ask how can i restore this empty space to vmware datastorage that this partition would be only 50 GB. Can i do this with vCenter or i need other tools. Thanks for answers.storage.png

Reply
0 Kudos
8 Replies
JCMorrissey
Expert
Expert

Hi,

Sure to shrink vmdks you can use http://www.techrepublic.com/blog/networking/how-to-shrink-a-vmdk-using-vmware-converter/5362

For vhd's http://myitforum.com/cs2/blogs/mclanem/archive/2011/04/05/two-methods-for-shrinking-a-vhd.aspx

Many tx!

Please consider marking as "helpful", if you find this post useful. Thanks!... http://johncmorrissey.wordpress.com/
Tadziz
Contributor
Contributor

I will try it and write how it worked for me. Thx

Reply
0 Kudos
Tadziz
Contributor
Contributor

i need more help. So the situation.

as i told i have VM with increased disk size C and it also has additional disk D witk MS SQL databases. i want to do like this.

1. using vmvare converted convert ONLY C drive and shrink it to 50 GB.

2. attach NEW shrinked vmdk to OLD VM.

3. Start VM and see that everything is ok Smiley Happy

Questions:

1. Will it work ?

2. will it still have D disk with MS SQL databases in it ?

Thanks,

   Tadas

Reply
0 Kudos
aravinds3107
Virtuoso
Virtuoso

In the VMware Converter while doing the conversion during the disk section, Select the volume based cloning and adjust the disk which you need to shrink and leave the disk untouched.

Converter will create a new VM with new disk which will have both C and D, Once the conversion is complete power ON the VM and test. When testing is completed Power OFF the old VM

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful |Blog: http://aravindsivaraman.com/ | Twitter : ss_aravind
Reply
0 Kudos
timrondeau
Contributor
Contributor

This will work but would require a little bit of naming and moving things around to get it done unless you have different clusters to work with.  When you run converter against the VM you will have to give it a name.  You wont be able to give it the same name but you could make something like computername-tmp.  You would basically want to do it in the following order.

1. Use converter to convert the machine into a new machine named computername-tmp.

2. Once that is completed power off your virtual machine. 

3. You would then move the virtual disk from the new machine over to your old machine. 

4. Remove your old virtual disk for your C drive in the settings and add a new drive pointing to the existing storage and the new C drive virtual disk.

My recommendation would be to just clone the entire machine but that also depends on the size of your data drive.  If your data drive is very large then I could understand why you would not want to clone a drive that really doesnt need changes performed on it.  If however it is small then i would just save the time and little headache from moving and renaming and just convert the machine into a clone.  Rename your old machine first to something like computername-old and then use converter to make a new "clone" of the machine with the updated drive sizes. 

Tadziz
Contributor
Contributor

My second D drive is not large, but it is on SSD RAID and here are no space left on it to put a clone. @timrondeau I think your answer will help me. I will let you on Monday know how it was for me , because i'm plannig to do all this stuff at saturday evening when no one will be using our servers.

Reply
0 Kudos
timrondeau
Contributor
Contributor

Yes definately let me know how it goes.  Also while I do not know the size or configuration of your environment you could clone the machine using converter to an entirely new datastore or even another cluster that has the space.   There are many different methods you could use which are all dependent on your setup and environment but there are other approaches you could take as well. 

So give it a try as you were saying and let me know how it goes and if you need more help I would be happy to assist in any way that I can. 

Reply
0 Kudos
Tadziz
Contributor
Contributor

I solved this problem. First i renamed OLD VM, and converted it to NEW VM to a different data storage both data disks C and D. After that i moved OLD VM's D drive out on SSD data storage and moved NEW VM's D drive to SSD storage using vCenter Migration tool.

In this link you can see how to use vCenter MIgration Tool, to move disks.

http://ict-freak.nl/2011/04/01/storage-vmotion-only-one-hard-disk-to-another-datastore-in-vsphere/

Thanks for help. My problem Solved

   Tadas

Reply
0 Kudos