2018年12月7日 星期五

How to backup and restore (WSL) Windows Subsystem for Linux?

Backup WSL (Windows Subsystem for Linux)


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


Restore WSL using lxrunoffline
# 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

沒有留言:

張貼留言