How to mount a VHDx or VHD file on Linux?

How to mount a VHDX or VHD file on Linux?

I mean attaching a virtual hard disk as a block device and using external tools to read these devices.

The file system is not mounted inside. I do not need to mount the file system, but deal with it as if it were on a real hard drive.

I read the guestfish , but could not find how to do this.

+5
source share
1 answer

You can use libguestfs-tools to achieve this.


  • First you need to install it on Ubuntu / Debian-like Linux, which would be the following:

     sudo apt-get install libguestfs-tools 
  • Then you can mount almost anything you want:

     guestmount --add yourVirtualDisk.vhdx --inspector --ro /mnt/anydirectory 

    This is just an example of a read-only extraction point.


Tips:

  • Run it as a regular user, i.e.:

     guestmount ... 

    Instead:

     sudo guestmount ... 
  • Switches; Quotes from the man page :

     --add 

    Add a block device or virtual machine image.

     --inspector 

    Using virt-inspector (1) , check the drives that are looking for the operating system and mount the file systems, since they will be installed on a real virtual machine.

     --ro 

    Add devices and install everything read-only. Also disable writing and make the disc read-only in FUSE.

+11
source

Source: https://habr.com/ru/post/1247797/


All Articles