Tuesday, December 22, 2009

Shrinking a VM Machine Disk

Most of the time the problem with disks is that we run out of space. Yet, there are times when we need to shrink (decrease the size of a disk). Case in point with VMWare, I created a server and allocated 40 Gigs for the System Disk. In reality, I did not need that much since It is a pretty much static web server, and I created a second disk for the Web sites.

The biggest problem with it was the backups. When I say backups, I mean backing up the Virtual Disks themselves. With a 40 gig disk, which I happened to allocate all the space ahead of time for performance reasons, the backup is too long, I have to shutdown the server because I am only using a free backup utility that being the free version does not do the snapshot, then backup leaving the server running. Instead I have to shut it down to back it up. This leaves my server down for too long.

So I need to shrink it. This server is on ESXi. In the past a method I have used is to attach another disk (bigger/smaller) whatever, and then booted from a Ghost disk, then Ghosted to the second drive. Shut the server off. Then, change the SCSI Id of the second drive to the one from the first drive. Then I would disconnect the original drive, not delete the drive, and boot. This works pretty good.

Another method, which I find equally as efficient, and maybe better, is to create a second VM by doing a Virtual to Virtual copy using VMWare Converter. When you set up your converter job you can specify the size of the disks. You do have to have your machine turned off, but that is OK. Leave it off. When done, fire up your copy and test. When satisfied, delete the old one if desired.

In future blog, I will go into greater detail on both expanding and shrinking virtual hard drives in VMWare; but for now you get the idea.


No comments: