windows
实测环境:windows 11, 64 bit.
ref:
Mount-DiskImage (Storage) | Microsoft Learn
Dismount-DiskImage (Storage) | Microsoft Learn
Get-DiskImage (Storage) | Microsoft Learn
bash
# 查询
Get-DiskImage -ImagePath "f:\wsl\ext4.vhdx"
# mount
Mount-DiskImage -ImagePath "E:\ISO-Files\My US Visit Fall 2010 Pictures.iso"
Mount-DiskImage -ImagePath "f:\wsl\ext4.vhdx"
# unmount
Dismount-DiskImage -ImagePath "f:\wsl\ext4.vhdx"
ubuntu
对应版本:
bash
# http://libguestfs.org/guestmount.1.html
sudo apt-get install libguestfs-tools
# 查询
mount
# mount
sudo guestmount --add ext4.vhdx --inspector --ro /mnt/mymount
--add
Add a block device or virtual machine image.
--inspector
Using virt-inspector(1) code, inspect the disks looking for an operating system and mount filesystems as they would be mounted on the real virtual machine.
--ro
Add devices and mount everything read-only. Also disallow writes and make the disk appear read-only to FUSE.
# unmount
sudo umount /mnt/mymount