WSL2 Backup to OneDrive Cloud

Posted on Wed 31 January 2024 in windows • Tagged with linux, vm, development

WSL2 provides great disk performance, but it requires storing the files separately in a virtual disk that is not accessible by OneDrive. WSL2 can be backed up with wsl --export Debian to a VHD or TGZ, but that is a complete disk backup of 20gb or more -- not scalable for hourly backups.

With this approach, we use Windows Task Scheduler to trigger robocopy to incrementally sync directories from WSL2 to Onedrive's native FS, so incremental copies are fast ( 1 s per 10k files), and OneDrive sync time remains negligible.

It's also useful for snapshotting subdirectories to TGZ for offline or …

Continue reading