▲ | Dylan16807 3 days ago | |||||||||||||||||||||||||||||||||||||
I think Optimize-VHD will do the same thing as messing with diskpart. It's a shame you can't just turn on live TRIM support. This kind of disk image is a bunch of multi-megabyte blocks of data, plus a list of where each block goes on the virtual disk. Implementations can support TRIM by deleting the block that's zeroed and moving the block at the end of the file into that spot. VirtualBox can do this, shrinking the file when the guest OS TRIMs, but Hyper-V can't. | ||||||||||||||||||||||||||||||||||||||
▲ | wtallis 3 days ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||
It seems like just using a sparse file would make things simpler. I guess there would be potential inefficiency when you try to move the VM to another drive, but for just storing and using the VM in place it doesn't seem like this has to be hard: a TRIM inside the VM gets translated into a hole punch in the disk image file, which gets translated into a TRIM sent to the underlying storage. | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
▲ | vrighter 3 days ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||
and the vhdx format already allows for this too. You can mark a block as "present, but zeroed out" (contents of never accessed blocks is undefined). These types of blocks don't have an actual block of data in the file, but still have well defined semantics. |