Score:0

Why does vhdx file take more space than actual data in ext4 partition

cn flag

I know Hyper-V is not able to handle ext4 file system, thus the compact will not compact correctly.

But I found some articles on the web suggesting zeroing unused space.

df -h actually returns :

Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
udev               424M       0  424M   0% /dev
tmpfs               88M    488K   88M   1% /run
/dev/sda1           20G    1,9G   17G  10% /
tmpfs              440M       0  440M   0% /dev/shm
tmpfs              5,0M       0  5,0M   0% /run/lock
tmpfs               88M       0   88M   0% /run/user/1000

Which tends to state that only less than 2Gb is used.

But vhdx file was 5,8Gb.

I used fstrim command in Linux VM (Debian 11), then shutdown the VM, and started to shrink the vhdx. It went to 4,7Gb. Still more than double as the content.

Then I did :

dd if=/dev/zero of=~/zeroes
sudo sync
rm ~/zeroes

Then shutdown and shrink the vhdx, no change, still 4,7Gb.

What's happening there and how is it possible to recover more space ? (I have a lot of Linux VM's with same issue, taking up a lot of unnecessary space on my test host).

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.