Mount a Disk Image Witouth Root Privileges

I have a disk image that contains multiple partitions, and I was trying to mount one of them on a Linux box. The only problem was that I didn’t have root privileges, so I couldn’t use mount. The solution is to use guestmount, which is part of libguestfs.

For example, here I mount the /dev/sda1 partition of the disk image disk.img:

1
2
mkdir ./mnt
guestmount -a disk.img -m /dev/sda1 ./mnt