SSD Trim and vhdx under Windows Server 2012 RRS feed

  • Question

  • Hello

    Sounds like a simple question but I can't find a confirmation on google. Does Hyper-V 2012 support TRIM commands for VHDX files?

    If I create data in a VM, the physical .vhdx file will expand to its max capacity. And if I then delete this data, the .vhdx file size will not reduce unless I compact it from the host. Assuming I don't compact it, my intuition is that the SSD cannot be aware that this large .vhdx file contains lots of empty blocks that the drive could use to level the cells wearing.

    Unless Hyper-V does something smart and that the VM actually passes on the TRIM command to the SSD so that these empty blocks get recycled.

    Would anyone be able to confirm what actually happens?



    Friday, May 3, 2013 11:26 AM

All replies

  • I am also interested in this topic. Especially, what if you use LInux with ext4 and enable trim / discard. 

    I have 2 vhdx on this Linux System, one with 350 GB, one with 50 GB. 

    But they only use 250 GB and 25 GB. So I wanted to compress it, and nothing changed, as I read you have to prepare the disk. 

    What happens if I enable trim/discard? 

    - Will the vhdx file shrink by itself

    - Will the vhdx file become smaller if using compress manually. 


    Wednesday, May 15, 2013 12:16 AM
  • I asked the question on another forum and got my answer:

    If I understand the article, WS 2012 passes the TRIM command from the guest system to the SSD. The vhdx file does not shrink but the underlying SSD cells are recycled. That's pretty smart (I didn't think it was possible).

    If you compact the vhdx file, then yes it will shrink. However as far as I know, you have to shut down the guest system to do that. I personally run a script that does that once a month as I also want to have a small vhdx file to reduce the size of the back up files. But from an SSD point of view I now realize it is unnecessary. 


    Wednesday, May 22, 2013 12:41 PM