How to open a VHD or VHDx file in Linux

VHD or VHDx (newer version) is a Virtual Hard Disk file format used by Microsoft’s Hyper-V. To Open a VHD disk on Ubuntu, you can use guestmount command.

mount vhdx

To install guestmount, run the command

apt-get install libguestfs-tools

To see list of partiions available in a VHD/VHDx file, you can run

virt-list-partitions FILE_NAME.vhdx

Example

root@ip-172-30-1-114:/mnt# virt-list-partitions srv-kirikas-storage.vhdx
/dev/sda1
/dev/sda2
root@ip-172-30-1-114:/mnt# 

To mount a partition, run

guestmount -a srv-kirikas-storage.vhdx -m DEVICE --ro MOUNT_POINT

Example

root@ip-172-30-1-114:/mnt# mkdir /vhdx/
root@ip-172-30-1-114:/mnt# guestmount -a srv-kirikas-storage.vhdx -m /dev/sda2 --ro /vhdx/
root@ip-172-30-1-114:/mnt# 

In the above example, /vhdx is the mount point, you need to create an empty folder before mounting.

See mount

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *