http://libguestfs.org/
export LIBGUESTFS_DEBUG=1
export LIBGUESTFS_TRACE=1
# guestmount -a /vm/images/archlinux/archlinux.qcow2 -m /dev/sda1 --ro /mnt/
# virt-filesystems -a archlinux.qcow2 --all --long -h
# virt-df -a archlinux.qcow2 -h
Filesystem Size Used Available Use%
archlinux.qcow2:/dev/sda1 3,8G 485M 3,1G 13%
# virt-filesystems -a archlinux.qcow2
/dev/sda1
# virt-rescue --ro -a archlinux.qcow2
Welcome to virt-rescue, the libguestfs rescue shell.
Note: The contents of / are the rescue appliance.
You have to mount the guest's partitions under /sysroot
before you can examine them.
[root@(none) /]#
# virt-cat -a archlinux.qcow2 /etc/fstab
libguestfs Commands
Formatter "highlight/html" not found
# guestmount --rw -d winxp -m /dev/sda1 /media/
# guestmount --rw -d winxp -i /media/
# guestmount --rw -a winxp.qcow2 -i /media/
# fusermount -u /media
# guestfish -N fs:ntfs -m /dev/sda1 touch /this-is-a-test
This will create an empty NTFS filesystem in a disk image (called
'test1.img'), then touch one file. Since it doesn't involve any
existing filesystems or guests it's a good test of whether ntfs-3g is
working or broken.
You can also run:
$ strings -e l test1.img
to look at strings in the test image.