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).
0 Answers