Writing Stream Optimized VMDK

Stream optimized VMDK image allocates minimized space for a compressed cluster, which means if there is high compress ratio, a cluster possibly only takes one physical sector in the file. Which makes overwriting hard, especially when new data needs more sectors than previously allocated.

Attach the image to VMware and boot the VM to test this format, it seems that VMware wouldn’t do write to allocated clusters, but can allocate new cluster to save data.

Overwriting existing cluster requires measuring new data size and decide whether in-place overwrite is OK, if not we must look for other free space. Metadata in VMDK sparse has no such information for sector allocation algorithm, so if we want to fully enable writing to stream optimized, sector allocation bitmap will be introduced into block state. This should significantly increase memory usage and somehow complicate the driver.

Another approach is to allocate each non-inplace at the end of image and leave the old allocation unreferenced, which wastes disk space.

Comments