如何将 Windows 10 WSL 2 Linux 发行版移动到另一个位置 [英] How to Move a Windows 10 WSL 2 Linux Distribution to Another Location

查看:41
本文介绍了如何将 Windows 10 WSL 2 Linux 发行版移动到另一个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 10 已将 WSL 2 Linux 发行版安装到我的 C: 驱动器.驱动器空间不足.如何将发行版移动到另一个驱动器?

Windows 10 has installed a WSL 2 Linux distribution to my C: drive. The drive is running out of space. How can I move the distro to another drive?

推荐答案

Windows 10 命令 wsl 可用于将 WSL 分发移动到另一个位置.该过程使用 --export 和 --import 参数.例如,此命令会将名为 Ubuntu-20.04 的发行版导出到 Moved-Ubuntu-20.04.导入的发行版不能是现有发行版名称,因此,如图所示,指定了不同的名称 Moved-Ubuntu-20.04.

The Windows 10 command, wsl, can be used to move a WSL distribution to another location. The procedure uses the --export and --import arguments. For example, this command will export the distro named Ubuntu-20.04 to Moved-Ubuntu-20.04. The imported distribution cannot be an existing distro name therefore, as shown, a different name Moved-Ubuntu-20.04 is specified.

wsl --export Ubuntu-20.04 - | wsl --import Moved-Ubuntu-20.04 d:\wsl -

如果需要,您可以使用 wsl --unregister Ubuntu-20.04 删除原始发行版,从而释放空间.相同的导出/导入过程可用于重命名发行版,例如从 Moved-Ubuntu-20.04 重命名回原始的 Ubuntu-20.04.

If desired, you can remove the original distro, thus freeing up space, using wsl --unregister Ubuntu-20.04. The same export/import procedure can be used to rename a distro, such as renaming from Moved-Ubuntu-20.04 back to the original Ubuntu-20.04.

仅供参考,wsl 为导入的发行版提供了 ext4.vhdx 的文件名.

FYI, wsl gives imported distro the filename of ext4.vhdx.

这篇关于如何将 Windows 10 WSL 2 Linux 发行版移动到另一个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆