Here are examples for a file that is called myvhdxfile.vhdx that is mounted to /mnt/vhdxdrive
Example 1. Where guestmount is inspecting (-i) the disks looking for an operating system and mount filesystems:
- Install
sudo apt-get install libguestfs-tools
- Create a mountpoint e.g.
sudo mkdir /mnt/vhdxdrive
- Run
sudo guestmount --add myvhdxfile.vhdx -i --rw /mnt/vhdxdrive
- (optional when you are done inspecting the files) To unmount run
sudo guestunmount /mnt/vhdxdrive
Example 2. If you run into the error: guestmount: no operating system was found on this disk you can mount individual partitions by following these steps:
- Run
sudo guestfish --rw -a myvhdxfile.vhdx
- Type in
run and hit enter
- Type in
list-filesystems and hit enter and note the path to the partition
- Type in
exit and hit enter
The output of the above steps might look like this:
><fs> run
><fs> list-filesystems
/dev/sda2: ntfs
><fs> exit
Finally, you can mount the partition /dev/sda2 by running:
sudo guestmount --add myvhdxfile.vhdx --rw /mnt/vhdxdrive -m /dev/sda2
If you got a different partition path from running the list-filesystems command in guestfish than you should replace /dev/sda2 with this path in the above command.
Example 3.
If you want the mounted partition to pup up in files (nautilus) and be able to access it with your personal user account:
- Create a mountpoint in media
sudo mkdir /media/vhdxdrive
- Mount with user permissions
sudo guestmount --add myvhdxfile.vhdx -o uid=1000 -o gid=1000 -o allow_other --rw /media/vhdxdrive -m /dev/sda2
Change the uid and gid values to the corresponding ids of your user in above command.