26

I'm using Ubuntu and I have created a full copy of my system SSD hard drive with the following command:

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

and saved it on a backup HDD which is an NTFS drive.

I'm now on Windows 10 PRO and want to mount this image using WSL (Ubuntu 18.04). This is the command I'm using:

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

This is the error that I get:

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

This same command worked on Ubuntu.

Is it possible to mount this image using WSL?

double-beep
  • 5,031
  • 17
  • 33
  • 41
userQWERTY
  • 501
  • 1
  • 5
  • 12
  • 3
    apparently loop devices are not supported up to now: [Link](https://askubuntu.com/questions/1025219/wsl-dev-loop0-workaround) – bambino307 May 25 '19 at 08:22

1 Answers1

4

Try copying the ISO file into a folder on your computer (not inside WSL) and then mount the ISO using Windows Explorer. After that, use

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

For you that would be

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

Then run explorer.exe, navigate to the folder you copied the ISO to, mount the ISO, record the drive letter, and then type

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

This should give you the same functionality. After that, it will say

mount: /home/vishal/custom-iso/mnt: WARNING: device write-protected, mounted read-only.

This is in WSL 1, not WSL 2, but I suspect that it will work the same way. In fact, I think WSL 2 will be easier to mount the ISO because it is essentially its own self-contained virtual machine. Using Powershell, I was able to mount physical drives to it, so I see no problem with getting an ISO to mount properly in WSL 2

helvete
  • 2,455
  • 13
  • 33
  • 37
Vishal
  • 49
  • 2