How to do it
For Debian and Ubuntu this is pretty easy
sudo apt-get install libguestfs-tools
For Red Hat, Centos, Fedora
sudo yum install libguestfs-tools
For Arch Linux (my distro of choice) you need to install 3 packages from the AUR
git clone https://aur.archlinux.org/hivex.git git clone https://aur.archlinux.org/perl-sys-virt.git git clone https://aur.archlinux.org/libguestfs.git cd hivex makepkg -si cd ../perl-sys-virt makepkg -si cd ../libguestfs makepkg -si
Once you have libguestfs as a normal user (not root / sudo) run guestmount
guestmount --add old_server_backup.vhd --ro /mnt/vhd/ -m /dev/sda1
--addoption is for the image you want to access
--rosets to read only, alternatively you could use
--rwfor read / write
/mnt/vhdthe path where you want to mount the drive
-m /dev/sda1specify which partition within the .vhd file you want to mount.
So I recently had to mount a backup of an old VM that was saved as a .vhd file and so I googled "How to mount a VHD on Linux" and the first result that came up was a Ubuntu forumns post where someone had asked the question and the top reply was someone else telling that person to go off and use a search engine. Followed by a link to Stack Overflow which didn't actually answer the question.
Some support forums and Stack Overflow in particular can be quite toxic to new comers (and even toxic to experienced veterans) and it's very infuriating when the top result on google is someone being told to just search google for the answer.
I know it can be annoying when simple questions come up over an over again but at the very least try to link to a useful article and if possible quote the relevant bit.
Anyway I hope my instructions saved someone the frustration that I went through.