3

I want to mount a raw made with New-VHD -Path "H:\comfyui\ComfyUI.vhdx" -SizeBytes 1000GB -Dynamic vhdx disk into WSL2 (ubuntu-22.04), i tried: how to mount .vhdx image in lubuntu (example 2 raised that error too.) but i got this error:

/mnt/h/comfyui$ sudo guestmount --add ComfyUI.vhdx -i --rw /mnt/ComfyUI
libguestfs: error: /usr/bin/supermin exited with error status 1.
To see full error messages you may need to enable debugging.
Do:
  export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again.  For further information, read:
  http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.

So that didn't work. I also tried just mounting it with: wsl --mount "H:\comfyui\ComfyUI.vhdx" --type ext4 and that didn't work either. I also do not know how to format to ext4 from windows, so I don't know what I though it would work. and -type raw doesn't work either. I also ask chatgpt for help and after some different iteration of the wsl --mount I am not sure if it matter but i have a docker desktop and that can mount it's stuff: Docker off:

sda    8:0    0 388.4M  1 disk
sdb    8:16   0     8G  0 disk [SWAP]
sdc    8:32   0     1T  0 disk /mnt/wslg/distro

Docker on:

loop0   7:0    0 531.9M  1 loop /mnt/wsl/docker-desktop/cli-tools
loop1   7:1    0   625M  1 loop
sda     8:0    0 388.4M  1 disk
sdb     8:16   0     8G  0 disk [SWAP]
sdc     8:32   0     1T  0 disk /mnt/wslg/distro
                                /
sdd     8:48   0     1T  0 disk /mnt/wsl/docker-desktop/docker-desktop-user-distro
sde     8:64   0     1T  0 disk

If I need to add any log please tell me so! Thanks in advance!

1 Answers1

3

Reusing (with some updates) most of my SuperUser answer on this topic ...

  1. Probably best to restart Windows if possible to make sure everything is in the correct "state".

  2. You've already created H:\comfyui\ComfyUI.vhdx - Great.

  3. You need need to take ownership of it. In either an admin CMD or PowerShell, run:

    takeown /f H:\comfyui\ComfyUI.vhdx
    

    Credit to this SuperUser answer

  4. Start your Ubuntu distribution and run:

    lsblk
    

    Take note of which devices exist.

  5. Mount the drive in WSL (you can do this from inside Ubuntu):

    wsl.exe --mount --bare --vhd "H:\\comfyui\\ComfyUI.vhdx"
    
  6. List the block devices again to find the name of the new one:

    lsblk
    # => NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    # => sda    8:0    0 388.4M  1 disk
    # => sdb    8:16   0     4G  0 disk [SWAP]
    # => sdc    8:32   0     1T  0 disk /mnt/wsl/instances/distro1
    # => sdd    8:48   0     1T  0 disk /mnt/wsl/instances/distro2
    # =>                                /mnt/wslg/distro
    # =>                                /
    # => sde    8:64   0  1000G  0 disk
    

    In my case, the new sde is the newly mounted device.

  7. Format the drive - Replace <device> with the name of the new device. Remember, this is a destructive, non-recoverable operation, so be sure you have it right:

    sudo mkfs.ext4 /dev/<device>
    
  8. Unmount the device from WSL. Note that it is not yet/currently mounted in Ubuntu:

    wsl.exe --unmount "H:\\comfyui\\ComfyUI.vhdx"
    # => The operation completed successfully.
    
  9. Remount as a named drive in WSL and Ubuntu:

    wsl.exe --mount --name=comfy --vhd "H:\\comfyui\\ComfyUI.vhdx"
    # = >The disk was successfully mounted as '/mnt/wsl/comfy'.
    # = >Note: The location will be different if you have modified the automount.root setting in /etc/wsl.conf.
    # = >To unmount and detach the disk, run 'wsl.exe --unmount \\?\H:\comfyui\ComfUI.vhdx'.
    

The drive should be successfully mounted and ready to use:

ls /mnt/wsl/comfy/
# => lost+found/
NotTheDr01ds
  • 22,082