Skip to main content
  1. Posts/

WSL-05 WSL迁移

·312 words·
loading
·
Tech WSL Ubuntu
Table of Contents
WSL - This article is part of a series.
Part 6: This Article

WSL迁移不止是为了给C盘腾空间,也是为了方便进行备份

查看WSL状态
#

WSL -l -v
如果Running运行状态,关掉它
WSL --shutdown

导出系统镜像
#

WSL --export Ubuntu E:\Ubuntu\ubuntu.tar

在路径下有了Ubuntu的压缩包,可以把这个压缩包备份,也可以直接导出到备份盘里,主文件并不受影响

注销原有的linux系统
#

WSL --unregister Ubuntu
可以再查看是否注销:
WSL -l -v

导入系统
#

WSL –import <导入的Linux名称> <导入盘的路径> <ubuntu.tar的路径> –version 2 (代表 WSL2)

WSL --import Ubuntu E:\Ubuntu\ E:\Ubuntu\ubuntu.tar --version 2

对比前面,路径下多了一个 ext4 映像文件

修改默认用户
#

打开WSL ubuntu之后,默认以root身份登录。

ubuntu.exe config --default-user <你的用户名>

ubuntu.exe :前面导入的时候没指定,所以这里用的默认ubuntu

WSL - This article is part of a series.
Part 6: This Article

Related

WSL-03 GUI界面
·1374 words·
loading
Tech Ubuntu WSL Gnome
WSL-02 配置网络代理和远程访问
·1246 words·
loading
Tech Clash WSL Ubuntu Vscode Ssh
WSL-01 安装WSL和Ubuntu
·774 words·
loading
Tech WSL Ubuntu
WHY WSL?
··459 words·
loading
Tech WSL Ubuntu Clash Linux
WSL-04 开发环境配置
·566 words·
loading
Tech Vscode Ubuntu Pwndbg
系统环境变量配置不生效
·823 words·
loading
Tech PATH