挂载 kvm qcow2 文件

挂载 kvm qcow2 文件

所以我有一个正在尝试安装的 kvm 映像:

[0c79dafb-abb7-4714-9a0a-4e16f0b305e7]# tree
.
├── console.log
├── disk
├── disk.info
└── libvirt.xml

[0c79dafb-abb7-4714-9a0a-4e16f0b305e7]# qemu-img  info disk
image: disk
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 4.8G
cluster_size: 65536
backing file: /var/lib/nova/instances/_base/fdb833a78da2cbc435b43cad1bbc64b5d13ec740
Format specific information:
    compat: 1.1
    lazy refcounts: false

当我尝试时kpartx它似乎什么也没做:

[0c79dafb-abb7-4714-9a0a-4e16f0b305e7]# kpartx -lv disk
loop deleted : /dev/loop0

有什么想法吗?谢谢!

答案1

kpartx仅适用于原始(未压缩)图像。要挂载 libvirt 支持的任何图像,请使用guestmount(1)

guestmount -a IMAGE MOUNTPOINT

相关内容