There are several scenarios under which you can benefit from zero-filling free space:
- P2V Conversion
- Thin-Provisioning with Physical Servers on Zero-Detect SANs
- Thin-Provisioning with Virtual Servers
- Datacenter Moves
When converting from physical to virtual servers with thin-provisioning, significant storage space can be saved when you combine disk defragmentation and zero-filling free space. If a physical server has never been defragmented, there is a good chance the active files and the free space on that server are both in hundreds or thousands of fragments. This means both file reads and writes take longer than they should. Virtualizing a fragmented and inefficient physical server gives you a fragmented and inefficient virtual server.
A better solution is to first defragment the physical server and consolidate its free space, followed by a zero-fill of the free space before the virtual conversion. We took a 2GB thin-provisioned VMDK and populated it with 723MB of data. When we defragmented and zero-filled the free space, the resultant post-virtualization VMDK was 20% smaller than the one with no defragmentation or zero-fill. This represents a considerable savings when applied to terabytes of storage.
Thin-Provisioning with Physical Servers on Zero-Detect SANs
When thin-provisioning with physical servers the growth of data correspondingly allocates, or provisions, more storage on the SAN. Imagine a 500GB thin-provisioned disk that was actually using 200GB. Due to some action, a 200GB temporary log file is written to this disk, causing another 200GB to be allocated, for a total of 400GB. When the temporary log file is deleted, the disk allocation remains 400GB. Thin-provisioned disks never get smaller by themselves. Provided the SAN has zero-detection capability such as is available from HP 3PAR Gen 3, EMC Symmetrix and Hitachi Data Systems, the solution here would be to zero-fill the free space. The zero-detection in the SAN will reclaim all the free space that has been zeroed and the disk allocation will return to its original 200GB.
Thin-Provisioning with Virtual Servers
Thin-provisioning virtual servers is similar to physical servers, but with a bit of a twist. Virtual servers usually involve a thin-provisioned virtual disk where the physical storage is also thin-provisioned. This practice is referred to as “thin-on-thin.” Some think thin-provisioning virtual disks are a bad practice, leading to over-provisioning and outages. In that case, it can lead to more work for the system or storage administrator.
Like its counterpart on the SAN, the thin-provisioned virtual disk grows and allocates storage on the host. This is turn causes the thin-provisioned physical storage to grow proportionally. The advantage to a virtual disk is that the virtualization vendors provide a shrink utility that enables compaction of the disk. However, the quality of the compaction depends on the locality of the data on the disk. For example: If a 500GB volume has its last data record located 450GB into the disk, it will get less compaction than a disk where the last data record is located only 200GB into the disk.
This problem is remedied by defragmenting the virtual disk and consolidating its free space, followed by a zero-fill of the free space. You may want to use a third-party defragmentation tool, like PerfectDisk, which specializes in consolidating free space. Defragmentation moves the files to the “front” of the disk and creates a large piece of contiguous free space at the back. The zero-fill pass writes zeros to all of the contiguous free space. Performing a VMotion to another datastore on VMware shrinks the virtual disk and frees up the space trapped within the virtual disk. You can do the same thing with a compression on Hyper-V. Which leads us to the next beneficial use of zero-fill: faster datacenter moves.
When transferring VMs to another datacenter, one generally does that via VMotion to another datastore. Running PerfectDisk’s Zero-Fill decreases the amount of data that is sent across the wire, which decreases the amount of time necessary for the VMotion to complete. When moving VMs from one datacenter to another, this will decrease the amount of data crossing the WAN, which reduces the overall time of the move.
While file systems know which files are valid the SAN has no way of knowing if data written to a physical block is a part of a valid file or an artifact of something previously stored in that location but no longer used. Zero-filling the free space ensures that any space the file system regards as free space is zero-filled, in effect eliminating all artifacts on the disk. While this in no way implies protection against a thorough forensic scan of the disk, it does provide some peace of mind about the validity of data on the disk. With virtual disks it also allows an efficient compaction which minimizes the disk size to that which is being used.
How to Zero-Fill Free Space