3

So, I had a hard drive with Windows 8.
The drive started dying, so I made an image backup to an external HDD.
Because it's practically impossible to get an ISO of Windows 8, I installed Lubuntu.

Now I'm restoring the backup and moving my files into Lubuntu, but can't figure out how to mount a .vhdx image. How do I do this?

1 Answers1

2

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:

  1. Install sudo apt-get install libguestfs-tools
  2. Create a mountpoint e.g. sudo mkdir /mnt/vhdxdrive
  3. Run sudo guestmount --add myvhdxfile.vhdx -i --rw /mnt/vhdxdrive
  4. (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:

  1. Run sudo guestfish --rw -a myvhdxfile.vhdx
  2. Type in run and hit enter
  3. Type in list-filesystems and hit enter and note the path to the partition
  4. 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:

  1. Create a mountpoint in media sudo mkdir /media/vhdxdrive
  2. 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.

samy
  • 445