Resizing Virtual Hard Disk on WMWare Workstation
I love my Virtual Subversion. Except the hard drive size. 120G is ridiculously large for a virtual machine. Especially when I broke it by 2G peaces to run it off a flash-drive: I just couldn’t stand looking at these 60 .vmdk files!And I don’t think my repo would ever take 120G. If you think you would, check this out.
So I decided to resize the Virtual Hard drive to make it smaller, say 10 Gb instead of 120Gb. Resizing the drive is easy, as long as you expand it. But shrinking the virtual hard disk is as hard as then shrinking a physical one. Vmware-vdiskmanager can only expand. And don’t confuse –k option: it does shrinks the vmdk file, but doesn’t alter the Hard Disk size.
I have tried whole bunch of tools in various combinations, and all the different approaches. Sometimes it failed at the beginning. Sometimes it seemed to go all the way but at the end the damn VM kept on failing to boot. I stuck at the office to the midnight, the alarm went off… I should list the tools that dind’t work out, but I am sick of them. It was frustrating. But it was also very revealing.
I figured: Virtualization is Freedom! Working with virtualized hardware is liberating! And as any new liberty, it has to break some stereotypes. We used to think of some solutions as “easy and cheap” and others as “hard and expensive”, some “prohibitively expensive”. This is all changing in the virtual world.
Messed up a virtual hard drive? Think before fixing it. Throw it away, get another one. Not enough space on a drive? No need to drive to Best Buy for exchange: dump it and get a new one. Need another computer? Get one! 10 clicks it is up and powered. I can create a new VM just to check out a new disk. And dump it. I created a VM just to check out a bootable image.
Not enough memory? Get more! Tired on single-core processor? Make it dual! Want to see what is on a hard disk? Plug it in to your existing machine. And for the off case, snapshot the machine and revert to a snapshot when done playing. Want to map a disk to your physical machine? No problem, map it! Want to map your physical machine’s disk to a VM? O-ho… careful here you are getting too real J
Playing with virtual hardware is cheap. I toasted few hard disks and tossed away couple of computers, it didn’t cost me a thing in a virtual world. Even burning a CD comes at zero cost, I don’t even need Daemon Tools, .iso is native there. It is quick. Booting up a VM still eats time, but changes to the hardware take no time.
As it is easy, and cheap, I got courage to do things that I would never attempt on a hard metal system. Well, when the disks contain valuable data, the back up is in order.
When it comes to backing up data, you don’t scratch your head how to do it: it is just copy files!
The last lesson holds true in a physical world, but virtualization amplifies and magnifies it:
Hardware is cheap, labor is expensive. After all, I got into all these troubles to preserve a well configured Subversion server. Although I spent a few hours breaking through the wall, it was mostly playing with new toys. Installing and configuring a full blown Subversion from the bare metal would be more involving, and mess-up-prone.
Finally, how to resize your VMWare Workstation 6.0 Virtual Hard Disk:
dd if=/dev/sdb of=/dev/sda
- Power off (who cares it’s CD)
- Detach Old Hard Disk
- Remove Rescue CD from virtual CD Rom
- Power on the VM.
- Prey, this helps.
- Send me some feedback.