# About VMOptimizer

VMOptimizer is a powerful utility for optimizing virtual disks. To understand how it works, you need to understand a bit about how virtual disks work.

Virtual disks work by storing the content for a disk in a file or group of files on another disk. The features they offer vary depending on the exact kind of virtual disk image, but they can have the following advantages:

- Sparse Formats

  Sparse virtual disks allow you to only store the data that is being used. That means that you can have a virtual disk that appears to be, say, 40 GB in size, but if only 20 GB is used, it will only use up 20 GB of space.

- Compression

  Compressed virtual disks allow you to save space by compressing the data contained within them. Read-only virtual disks would usually be compressed whilst compressed virtual disks that you can modify are not very common.

- Encryption

  Virtual disks can be encrpyted to keep your data safe from prying eyes. The downside is that you will suffer a performance penalty as the CPU has to work to compress and decompress your data.

- Alternate File Systems

  Virtual disks allow you to use different file systems with different features to the file system that the virtual disk is stored on. For example, you might need to use a case sensitive file system when you only have access to a case insensitive file system.

- Packaging

  Virtual disks can make a convenient format for packaging data. For example, images of CDs and DVDs can be stored as virtual disks and can be written or burnt to recordable CD or DVD media.

- Snapshots

  Snapshots (also known as shadows) are the ability to isolate changes to a disk image. Changes are recorded in a separate file whilst preserving the original virtual disk. This can allow you to revert to the original virtual disk at any time or it can be used to make a writable virtual disk from a disk image that is read/only.

## Fragmentation

In an ideal world, all the data for every file would be located at a single location on your disk and grouped together. Imagine a 20 GB file located somewhere on your 500 GB disk. If you knew that the 20 GB file was located 100 GB from the beginning of the disk and for the following 20 GB, that would be the fastest and easiest way of storing that file. In practice, that doesn't happen. Your file system contains many files and there might not be a 20 GB bit of space to store your file, so you'd either need to move something else out of the way to make the space, or you split your file into chunks and then try and store those chunks.

Over time, after you’ve performed OS upgrades and deleted some files and created others, the situation can get worse and more and more files will get fragmented. The larger the file, the more likely it is that it will get fragmented and you find files that have thousands of fragments.

Now consider a virtual disk. A virtual disk consists of a file (or a group of files) and it can get fragmented. Inside the virtual disk, there will be another file system, and this can also get fragmented. On top of this, sparse virtual disks add another level of possible fragmentation. So there are three kinds of fragmentation involved with virtual disks and if you want to fix it, you need to deal with all three levels. This is where VMOptimizer comes in.

VMOptimizer looks at virtual disks and creates a new virtual disk that eliminates all three kinds of fragmentation. Obviously, you could tackle all three using different tools, but that’s awkward, time consuming and might not be as efficient as VMOptimizer.

## Sparse Virtual Disks

Most writeable virtual disks are sparse virtual disks and they save space by not writing data for unused areas of the disk. That works well initially, but it relies on them being able to tell what the unused areas of the disk are. Now the file system within a virtual disk might have marked areas of the disk as unused (like when you delete a file), but in order for the virtual disk to know this, there needs to be understanding of the underlying file system. This is where VMOptimizer comes in: it understands the file system within the virtual disk and when it writes out an optimized virtual disk, it knows where the disk is unused and can save space by not writing any data for those areas.

## Partition Alignment

Some applications that use virtual disks prefer the data within the virtual disk to be aligned to a certain boundary for performance reasons.

VMOptimizer detects those cases and can automatically make adjustments to align the data for you. This may sound simple, but it’s actually quite difficult. VMOptimizer leverages technology used in our partitioning product, iPartition, to make sure that things run smoothly after realigning your data.

### Related Topics

Getting started