Backing up WSL files in Windows

Hi!

I’m using Duplicati to automatically back up my Win10 files. I’m also using WSL2 , and I would like to include my Linux files into the backup, preferably without running a separate Duplicati server or another tool.

What would be the best way to do it?
I tried adding the whole WSL’s virtual disk file ext4.vhdx to the backup but WSL wouldn’t start (I guess due to the file being used by Duplicati process).
Windows provides the access to the WSL files via \wsl$\ network share, I’ll try using this. But maybe there are better options?

Thanks!
Alex

One workaround for the locked file issue is to utilize snapshot-policy. Note that it requires running Duplicati as an elevated process.

Not sure if that’s the best approach. If you can add the wsl$ “share” as a source directory it might be more efficient. I haven’t experimented with it myself as I don’t run WSL.

I was able to backup specific folders/files using the wsl$ share, but I had to enable the skip-metadata option to avoid warnings about being unable to access metadata. There were also warnings given for symlinks.

Thanks for your input! Good to know this option may work for the OP.

Hi @drwtsn32, @kaliatech! Thanks for the tips!
Using the wsl$ share seems to work, but performance is horrible (on the WSL side I think; Task Manager is showing 99% memory consumption, most of it is used by WSL’s VM).
I’ll exclude node_modules, .cache and the like from the backup and see how it goes next time.