Replies: 2 comments 4 replies
-
Isn't there already Optimize-Vhd command available in Powershell? It can throw away unused data in the ext4.vhdx file. |
Beta Was this translation helpful? Give feedback.
2 replies
-
@Biswa96 yes, there are a couple of ways: using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using virtual drives is a great idea. But, ext4 filesystem optimization inside VHDX images is not so well supported by the optimization tools. NTFS partitions are well optimized, but ext4 partitions are not so well optimized, and WSL suffers from this problem.
Since WSL doesn't provide a good solution for this, I have coded a small utility wslcompact that compacts the WSL partitions. This is the usage of the tool:
WSLCompact v4 performs the compact process in a 'safe' mode. So, the user can cancel safely the, sometimes long, process without side effects.
The user can decide if the new image is replaced after the result, so the final decision is on the user. Most errors should be tracked now, but do not panic, should you receive an error message, it won't modify any image without the user's approval (unless you use the -y option).
And this is an example of a session:
Any thoughts on improving the tool would be welcome. However, it would be better if the WSL team releases something similar. A good improvement would be an improvement in the export function, not only making a copy of the VHD file but dumping the contents in a newly created VHD, which would considerably reduce the size of the backup.
Any work in this direction?
Beta Was this translation helpful? Give feedback.
All reactions