[root@localhost images]# ls centos7.qcow2 [root@localhost images]# qemu-img convert -f qcow2 -O raw centos7.qcow2 centos7.raw [root@localhost images]# ls centos7.qcow2 centos7.raw [root@localhost images]# losetup -f /dev/loop0 [root@localhost images]# losetup /dev/loop0 centos7.raw [root@localhost images]# kpartx /dev/loop0 loop0p1 : 0 4774528 /dev/loop0 2048 [root@localhost images]# ls /dev/mapper/loop0p1 ls: cannot access /dev/mapper/loop0p1: No such file or directory [root@localhost images]# kpartx -d /dev/loop0 [root@localhost images]# kpartx -av /dev/loop0 add map loop0p1 (253:0): 0 4774528 linear /dev/loop0 2048 [root@localhost images]# ls /dev/mapper/loop0p1 /dev/mapper/loop0p1 [root@localhost images]# mount /dev/mapper/loop0p1 /mnt [root@localhost images]# ls centos7.qcow2 centos7.raw [root@localhost images]# mount --bind /dev /mnt/dev [root@localhost images]# chroot /mnt /bin/bash [root@localhost /]# PATH=$PATH:/bin:/sbin:/usr/sbin:/usr/bin [root@localhost /]# mount -t proc none /proc [root@localhost /]# mount -t sysfs none /sys [root@localhost /]# ls
install virt-manager libguestfs-tools
[root@localhost images]# guestmount -a centos7.qcow2 -i --rw /mnt libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory libguestfs: error: could not connect to libvirt (URI = qemu:///system): Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory [code=38 int1=2] [root@localhost images]# systemctl restart libvirt Failed to restart libvirt.service: Unit not found. [root@localhost images]# systemctl restart libvirtd [root@localhost images]# yum install libguestfs-tools