logoalt Hacker News

tonymetyesterday at 10:42 PM0 repliesview on HN

this is great and I have a feature request: A "refresh VM" feature that exports your home dir + packages into a new VM instance.

I've tried Optimize-VHD but renewing the VM this way frees up disk and speeds up the VM as well. None of the WSL settings for sparse disk / disk shrinking seem to work well.

Here's what I usually do

   $ tar -czf /mnt/c/Temp/home-backup.tgz $HOME
   $ apt list --installed > /mnt/c/Temp/packages.txt
delete the VM, create a new one, reverse the process.

   $ tar -cxf /mnt/c/Temp/home-backup.tgz -C $HOME
   $ apt update
   $ cat /mnt/c/Temp/packages.txt | xargs apt install