在WSL(Linux的Windows子系统)上挂载磁盘映像?

时间:2018-12-20 18:31:43

标签: windows windows-10 filesystems mount windows-subsystem-for-linux

我正在使用Ubuntu,并通过以下命令创建了系统SSD硬盘的完整副本:

dd if=/dev/sda of=ubuntu.iso

并将其保存在备份硬盘上,该硬盘是NTFS驱动器。

我现在在Windows 10 PRO上,并想使用WSL(Ubuntu 18.04)挂载此映像。这是我正在使用的命令:

sudo mount -o ro,loop,offset=1048576 /mnt/a/ubuntu.iso /mnt/ubuntu_backup

这是我得到的错误:

 mount: /mnt/ubuntu_backup: mount failed: Operation not permitted.

该命令在Ubuntu上也可以使用。

是否可以使用WSL挂载该映像?

1 个答案:

答案 0 :(得分:1)

尝试将ISO文件复制到计算机上的文件夹中(不在WSL中),然后使用Windows资源管理器安装ISO。之后,使用

sudo mount -t drvfs [drive letter of your ISO]: /where/you/want/to/mount/it

那对你来说

cp /mnt/a/ubuntu.iso /mnt/[home drive letter, most likely C, lowercase]/wherever/you/want/to/put/it

然后运行explorer.exe,导航到将ISO复制到的文件夹,安装ISO,记录驱动器号,然后键入

sudo mount -t drvfs [drive letter of your ISO]: /where/you/want/to/mount/it

这应该为您提供相同的功能。之后,它会说

mount:/ home / vishal / custom-iso / mnt:警告:设备被写保护, 挂载为只读。

这是在WSL 1中,而不是WSL 2中,但是我怀疑它会以相同的方式工作。实际上,我认为WSL 2会更容易安装ISO,因为它本质上是它自己的独立虚拟机。使用Powershell,我能够在其上安装物理驱动器,因此我看不到将ISO正确安装在WSL 2中的问题

相关问题