Wsl2 转移Ubuntu20.04 安装路径

3 篇文章 1 订阅

Wsl2 转移Ubuntu20.04 安装路径

为甚要转移?因为安装在C盘空间不够用

1.查看当前安装的分发系统(我只安装了一个Ubuntu20.04)

wsl -l
适用于 Linux 的 Windows 子系统分发版:
Ubuntu20.04 (默认)

2.导出分发系统

​ wsl --export <DISTRIBUTION_NAME> <export name>.tar

​ wsl --export 子系统名称 导出路径 导出名.tar

wsl --export Ubuntu-20.04 D:\Wsl\Ubuntu-20.04.tar

3.注销原来的分发系统

wsl --unregister <DISTRIBUTION_NAME>

再用wsl -l命令查看已经没有原来的Ubuntu-20.04了

wsl --unregister Ubuntu-20.04
正在注销...

4.在你空间足够的盘创建一个Wsl文件夹,用于存放分发系统(我的:D:\Wsl)

5.导入分发系统

wsl --import <IMPORT_DISTRIBUTION_NAME> <IMPORT_PATH> <EXPORT_PATH>

wsl --import 导入的系统名称 导入的路径 导出路径(之前存放tar包的哪个路径)

wsl --import Ubuntu-20.04 d:\Wsl\Ubuntu-20.04 D:\Wsl\Ubuntu-20.04.tar
wsl -l
Ubuntu-20.04 (默认)

6.运行系统

bash
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Mar 11 14:00:26 CST 2021

  System load:    0.52      Users logged in:       0
  Usage of /home: unknown   IPv4 address for eth0: 192.168.1.54
  Memory usage:   41%       IPv4 address for eth2: 172.31.128.1
  Swap usage:     0%
  => There were exceptions while processing one or more plugins. See
     /var/log/landscape/sysinfo.log for more information.
0 updates can be installed immediately.
0 of these updates are security updates.
This message is shown once a day. To disable it please create the
/root/.hushlogin file.

7.注意
这样迁移过后的子系统默认还是wsl1版本的,如果是1版本是不能玩儿docker的.

~: wsl --set-version Ubuntu-20.04 2
映射网络

在这里插入图片描述

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

boothua

觉得可以的话,请作者喝杯咖啡吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值