I used to use windows 10 and made a backup (vdhx) of it on a external drive. Under the naive impression that data recovering from this image to ubuntu would be more straight forward I changed to ubuntu and now it is not straight forward.
Could someone explain to me how I can mount this image in ubuntu to look through my stuff and get what I need? Since I am a new to ubuntu a gui option would be highly appreciated but comandline would (with help) also work.
I already tried this (among others):
guestmount -a /path_to_external_drive/file.vhdx --inspector --ro mnt/vhd/(based on this: )
thanks in advance
3 Answers
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
runand hit enter - Type in
list-filesystemsand hit enter and note the path to the partition - Type in
exitand hit enter
The output of the above steps might look like this:
><fs> run
><fs> list-filesystems
/dev/sda2: ntfs
><fs> exitFinally, 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.
The first time I tried this I got:
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:
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.If this happens to you, and you're operating as a regular (i.e. non-root) user, you may not have permission to read the kernel. To check this, do:
ls -l /boot/vmlinux-`uname-r`If it shows up as, e.g.
-rw------- 1 root root 11399928 Nov 12 02:51 /boot/vmlinuz-5.3.0-23-genericthen you don't have permission to read the kernel. To correct this, either run guestmount as root with sudo, or do:
sudo dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-`uname -r`The latter will make the kernel world-readable and will allow you to use guestmount. Note that having the kernel world-readable may be a security risk, so do some reading if you're worried about it.
I played around with it a bit more and could solve it. the changes were: - change mountpoint to folder in home directory - there were 3 vhdx images created in the backup and apparently only contains the data I needed. (I am still unsure what the other ones are.)