Example: backup_wsl.sh
#! /bin/bash cd / tar vzcpf /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.tar.gz \ --exclude=/proc --exclude=/dev --exclude=/mnt --exclude=/media \ --exclude=/lost+found --exclude=/tmp --exclude=/sys --exclude=/run / \ > /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.log \ 2> /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.error
# lxrunoffline run -n <distro name> -w C:\wsl> lxrunoffline run -n mybackup -w
Refer to:
1. https://superuser.com/questions/1164818/how-to-backup-wsl-linux-subsystem-for-windows-10-before-system-reset-or-reins