S
S
sl02020-12-05 13:49:43
Windows
sl0, 2020-12-05 13:49:43

Where does the inadequate size of ext4.vhdx come from?

Good day. I have a couple of projects that I develop in Windows under wsl2. The projects themselves are very small, but recently I noticed that the disk space is starting to run out. It turned out that two files were to blame:
1. .../Docker/wsl/data/ext4.vhdx (30 gb)
2. .../ubuntu/ext4.vhdx (13 gb)

The first file belongs to Docker Desktop, the second to the distribution itself. My projects with all the strapping weigh no more than a gig. Where did such inadequate sizes come from and how to deal with it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sl0, 2020-12-06
@sl0

Understood. I am writing here for those who will face the same problem.
Cause.
I did not use docker-compose down, so every shutdown left unused volumes, which caused these files to swell.
Cleanup solution in Docker Desktop.
1. Install libguestfs-tools in wsl.
2. sudo mkdir -p /mnt/wsl
3. sudo guestmount -o allow_other --add mnt/c/Users/username/path_to_/ext4.vhdx -i /mnt/wsl
4. Clean up /mnt/wsl
5. After that, from Windows already run
wsl --shutdown
optimize-vhd -Path path_to_\ext4.vhdx -Mode full

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question