question

AnkitaKhimesra-6406 avatar image
0 Votes"
AnkitaKhimesra-6406 asked XinGuo-MSFT answered

Does Dynamic VHDX adds new files after end of deleted files?

We are using expanding VHDX (with HyperV) with Ubuntu. For expanding the disk we write to the temp file and delete it. For subsequent expansion looks like it doesn't takes differential size to increase the disk rather allocates new space.

Example:
I have created 20 GB temp file to allocate memory. And deleted that temp file. disk expands to 20 GB
Now I need space of 25 GB, SO I again created 25 GB temp file. But now the total disks expands to 45 GB.
It is not utilizing the space which we got from deleting that temp file.
SO is this a Known case with VHDX- Will it not consider the deleted file's space?

msc-virtual-machine-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLaude avatar image
0 Votes"
LeonLaude answered LeonLaude edited

Hi anonymous user,

I believe this article should be helpful for you:
Why Expansion for Hyper-V’s Dynamic VHDX Doesn’t Matter


If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!


Best regards,
Leon


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XinGuo-MSFT avatar image
0 Votes"
XinGuo-MSFT answered

Hi,

For the Ubuntu guest OS, after we delete the files, we can run the following command to reclaim the (unused) disk space.

fstrim /

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.