The process of shrinking virtual drives during or after a physical-to-virtual migration still troubles IT administrators....
Until Microsoft answers my prayer and develops a feature to aid shrinking during hard drive conversion, we must find ways using the tools at our disposal.
Virtualization offers the seemingly magical ability to move a physical system into a virtual environment: It sucks the soul out of a piece of physical hardware and lets it live on forever as a virtual machine, independent of physical boundaries, with the ability to float from host to host uninterrupted. If this is computer heaven, it still has some limitations. Virtual drive shrink is one of the features missing from the latest version of Hyper-V, and in a previous article, I offered a potential solution.
In this article, part one of a series, I point out why you would want to shrink your virtual drives. In part two, I'll explain a few methods that will help you achieve your hard drive downsizing goals.
Why should you shrink virtual drives?
Hard drives divide the worlds of physical and virtual servers. Physical servers are islands of resources, whereas virtual environments are communes of shared resources. Physical server hard drives come in certain defined sizes, such as 72 GB or 600 GB. Virtual hard drives, on the other hand, can be any size you want, but an oversized hard drive in a virtual environment wastes space that virtual machines (VMs) could otherwise use. Virtual hard disks (VHDs), however, usually reside on a storage area network, and the bloating of this disk real estate can be costly.
More things to consider for physical-to-virtual conversions
Using physical-to-virtual conversion to resuscitate a PC
How P2V tools influence hypervisor decisions
Physical-to-virtual best practices
For example, a physical server with a 300 GB hard drive may only use 50 GB of space. Moving this server into the virtual environment wastes 250 GB of space if you change it to a fixed-style disk.
Thin provisioning VHDs might minimize the amount of physical host disk space used, but for production VMs, you will end up trading performance for space. As data is written to the disks, additional writes are necessary in order to expand the boundary of this type of virtual hard disk. Additionally, if left as a thinly provisioned disk, it may grow to its full size and fill up a host's physical logical unit numbers (LUNs), causing service interruptions to other VMs sharing the same LUN. To curb this potential issue, always appropriately size your VM hard drives so you are not plagued by oversized drives or unexpected growth. To maintain this delicate balance, find the maximum utilization of resources in your virtual environment.
Before you shrink an oversized virtual hard drive
Before any shrinking process, it is good practice to do some cleanup first. Reduce the virtual hard drive to the minimum size needed. Often, installers, logs, backup files and previous software versions rob your hard drive of space over time. Cleaning up this data gives you a good storage baseline. Once you have deleted all unnecessary files, performing a disk defragmentation will better align the data on the drive and maximize your shrinking capabilities.
In part two of this series, I will discuss the available methods to shrink virtual drives.