Use LxRunOffline tool backup / restore Linux subsystem (WSL)

Installation WSL

Open WSL components

First need to open WSL components, you can use the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

You can also manually in [Control Panel] - [Programs] - [enable or disable Windows features] - [Windows subsystem for Linux] tick, and then determine then restart the computer.

Download image

Ubuntu can search directly in the app store, then you can automatically download and install.
Ubuntu after installation the default path:

C:\Users\WINDSUN\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState

If your Win10 is a streamlined version or no version of the application store, you need to manually download the image, give the following links to download each version release:

https://docs.microsoft.com/en-us/windows/wsl/install-manual

Figure:
Download the releases wsl

installation

  1. The Ubuntu.appx rename Ubuntu.zip
  2. Decompression
  3. The Ubuntu.exe right to run as an administrator, enter the user name and password can be installed complete

    Modify the default user

    Open powershell in extracting the root directory:

ubuntu config --default-user <username>

Once complete, you can use WSL happy, you can download VScode, installing a plug-in, you can direct the WSL.
However, configured WSL after you reinstall the system, all of the East sub needs to start all over again, so we need them to back up, then talk about WSL backup.

Backup WSL

Installation LxRunOffline

There LxRunOffline source code and compiled files on Github, Download:

https://github.com/DDoSolitary/LxRunOffline/releases

In the root directory of the software or CMD powershell after installation or decompression can be used to operate the command LxRunOffline

LxRunOffline commonly used commands

Using LxRunOffline.exe -hviewing software commands commonly used commands are as follows:

//已经安装的WSL
LxRunOffline.exe list 
//还原WSL
LxRunOffline.exe install -n <wsl_name> -d <res_path> -f <back_path>
//卸载WSL
LxRunOffline.exe uninstall -n <wsl_name>
//备份WSL
LxRunOffline.exe export -n <wsl_name> -f <back_path>
//启动一个WSL
LxRunOffline.exe run -n <wslname>

Backup / Restore WSL

  • View WSL currently present in the system
LxRunOffline.exe list

Ubuntu
  • Start Backup
LxRunOffline.exe export -n Ubuntu -f D:\UbuntuBackup.tar.gz

-n: wsl alias, that is, before a list view of one of the
-f: path backup, backup directly to my current path backup.tar.gz

  • Restore WSL
LxRunOffline.exe install -n Ubuntu -d C:\Users\WINDSUN\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState -f D:\UbuntuBackup.tar.gz

-n: to wsl a name
-d: reduction path wsl the
path of the backup file: -f

  • WSL start backup
LxRunOffline.exe run -n Ubuntu

Every time you need to open wsl in CMD, if you want to click on the icon to start directly Ubuntu, you can install the new system reinstall Ubuntu, the first not to open the first reduction with LxRunOffline directly to the installation directory you can directly click on the icon opens.

reference

Guess you like

Origin www.cnblogs.com/WindSun/p/12142604.html