ESXi 4.1 u1 - what's the best way to decrease a VMDK size?

Thx
IT_Group1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul SolovyovskySenior IT AdvisorCommented:
The easiest way is to perform a V2V (virtual to virtual) migration using VMWare Converter.  During the process resize the vmdk as needed.  
setasoujiroCommented:
if you configured the disk using thin provisioning then it's easy enough...
just shut down the machine, edit the disk and enter new value

if it's thick provisioned, then you will need to convert it to thin, and then shrink it.
to do so:
shut down vm
log in to shell(ssh) of esx host
cd /volumes/>yourdatastore</>vmname<
when in the correct folder:
enter this: vmkfstools -i yourthickdisk.vmdk -d thin yourthindisk.vmdk
when it's done you can just remove the thick disk from the vm(DO NOT delete it yet, just disconnect it from the vm) and then connect the new thin disk, edit the disk for size requirement

and boot the vm, if all seems well you can discard the thick(old) vmdk
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Use VMware Converter Standalone.

Download VMware vCenter Converter here

http://downloads.vmware.com/d/info/datacenter_downloads/vmware_vcenter_converter_standalone/4_0

VMware vCenter Converter Standalone 4.x Documentation

http://www.vmware.com/support/pubs/converter_pubs.html

VMware vCenter Converter Standalone 4.3 User Guide

http://www.vmware.com/pdf/convsa_43_guide.pdf

For the conversion steps, read fellow Expert Bestway's article.

http://www.experts-exchange.com/Software/VMWare/A_3639-VMware-vConverter-P2V-for-Windows-Servers.html

Best Practice Video Guide here

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004588

If all else fails do the following as it has helped me over a hundred times when converter fails

1.  Download trial copy of Symantec Backup Exec System Recovery
2.  Install and take an image of the server
3.  Use VMware Converter to convert image (it knows it natively) to a VM
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
this is another method, if you like command lines

Before VMware Convertor was developed which is very easy to use and shrink disks, this is how we would do it.

1. Firstly, using Partition/Server Magic or Gparted Live CDROM (http://gparted.sourceforge.net/livecd.php).

2. Use GParted to shrink NTFS (assuming windows) partition from xx GB to yy GB. You'll need to shutdown, and attach iso to VM, and reboot and boot from cdrom.

3.  Create blank yy GB VMDK (this is why I asked how much space you have remaining on your datastore to do this)

4. vmkfstools -c yyG -d thick new-yygdisk.vmdk

5. Copy the first xx contents of xx GB disk to new yy GB disk using DD

6. dd if=xx-flat.vmdk of=new-yygdisk-flat.vmdk bs=1048576 count=10240

7. bs and count are 10GB  in this example.

8. done.

but you need the space do do this operation on the datastore.
ericmorrisCommented:
Please note that if you use converter to shrink your vmdk, the resulting vm will be an *new* vm.
You might want to keep your original vm and connect the resulting disk to the original vm.
Working with a new vm (new UUID) might have several drawbacks for backup software and so on.
IT_Group1Author Commented:
Thx all!
When running VMware Convertor on the host, and selecting the correct guest (which is powered-down), the following error appear:

Unable  to obtain hardware information for the selected machine.

The Guest  is an SBS 2011 w/ 1 VMDK of 256GB.
Thx
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
VMware Converter must be run, either installed on the host or connected to the host whilst it is powered on.

Is the machine you need to convert OFF?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
You could also use vConverter in vCenter (if you have it available), to Export and Import the Guest back to vCenter, changing disk size, but the VM must still be OFF.
IT_Group1Author Commented:
Ok passed through it I change the VM type to server 2003 R2 x64 and the error disappears. Clearly this is a converter bug.

The issue now, when i want to decrease the disk size, it only shows as data cop type: copy all disks and maintain layout, and i can choose either Flat or Thin.
I beleive i should choose thin, and after conversation over, it'll let me decrease it right?

BTW, the converstion is taking place on the same host
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
It should allow you to specify a size, you don't want to maintain layout.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Are you using Converter Standalone, or Converter Export in vCenter?
IT_Group1Author Commented:
Converter Standalone. Doesn't allow to change size..
IT_Group1Author Commented:
Will Thin provisioning allow me to change disk size after completion?
setasoujiroCommented:
yes it will, but i really don't see why you don't just clone the disk to thin as i said before... you would've been done by now
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
No, the conversion process must reduce the disk size.

(but if you actually want to reduce the size to the OS, you'll need to convert)

Depends on the reasons to decrease VMDK size.

Obviously going from thick to thin, will reduce the storage space, until you use it all again.
IT_Group1Author Commented:
It's just not my lucky day.
setasoujiro: I've followed your advice and tried to clone the disk to thin. Although as you can guess it wasn't a successful attempt, since the vmkfstools didn't cooperate..

The exact command I've entered was: vmkfstools -i SBS 2K11.vmdk -d thin SBSTHIN 2K11.vmdk
Maybe it didn't went well because we have a space between the SBS and the 2k11?

hanccocka: I'm running the conversion now (thin, no size change) - let's hope I'll be able to reduce the size.

Thx
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Screenshot the Converter you are using?
IT_Group1Author Commented:
Version 4.0.1 Build-161434
Screenshot attached.

Strange, it's runiing for almost an hour, yet no estimated end time. Is there a way to monitor its progress?
Convert.JPG
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
IT_Group1Author Commented:
We didnt installed the vcenter yet. Is there a newer stanalone version?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Mistyped that is VMware Converter Standalone (sorry)

4.3 is the latest.

http://downloads.vmware.com/d/info/datacenter_downloads/vmware_vcenter_converter_standalone/4_0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IT_Group1Author Commented:
Thx, will try.
Do you happen to know if there are major fixes?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
support for Win2k8 and Win7 is the major one.
IT_Group1Author Commented:
Can i upgrade the current one, or perform a fresh install?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
It's a re-install, I believe.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Actually, I am correct is full title is know as VMware vCenter Converter Standalone!
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Okay, I've just checked for you.

When you get to the Destination Locations, this is where you change the size

(it's available in all Standalone versions)

See pick, you need to use the drop down, and enter a new size for the VMDK

 VMware vCenter Converter Standalone Destinations Location - This is where you change the disk size
IT_Group1Author Commented:
hanccocka, many many thx. I'll install the 4.3 ASAP,
And lets hope it'll let us change size.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
If you follow the options in picture, you should be able to change the size.
IT_Group1Author Commented:
It's working !! You're a bloody darn good magician ain't you?
THX
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
Yes, we do lots of "voodoo here".
setasoujiroCommented:
the command didn"t do well because you didn't quote the names "sbs disk.vmdk"
because it has spaces
setasoujiroCommented:
btw pressing tab in shell autocompletes :)
IT_Group1Author Commented:
THE MAN. Period
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.