I’m looking for a way to compress WSL2 distros while exporting it. For that purpose I’ve tried to pass the tar file produced be
7z through pipe:
wsl --export myDistro - | 7z a -tgzip myDistro.tar.gz -si
I waited about an hour but it produced nothing but cpu load.
7z process wasn’t even started according to Task Manager.
I tried to pass a sample tar file though pipe to
Get-Content -Path sample.tar -Raw | 7z a -tgzip sample.tar.gz -si
sample.tar.gz was created without any issue.
I also tried to export the distro to file instead of stdout:
wsl --export myDistro .myDistro.tar
It took about 15 minutes and the distro was exported successfully.
What am I doing wrong? How to compress an exported WSL2 distro to a gzip archive without storing the tar file on a disk? And how to import it through pipe with
wsl --import after that?