一、查看qcow2真实大小
首先检查qcow2文件原始大小为多少
#qemu-img info centos6.6.qcow2 image: centos6.6.qcow2file format: qcow2virtual size: 44G (47603253248 bytes)disk size: 1.9Gcluster_size: 65536Format specific information: compat: 0.10
从上看出磁盘真实大小为47603253248 bytes
二、创建lv
本文环境中sda6大小为100G
分别创建pv vg lv
注意: lv的大小为上文qcow2镜像的真实大小 单位为b
# pvcreate /dev/sda6 Physical volume "/dev/sda6" successfully created# vgcreate lvm_pool /dev/sda6 Volume group "lvm_pool" successfully created# lvcreate -L 47603253248b -n centos6.6 lvm_pool Rounding up size to full physical extent 44.34 GiB Logical volume "centos6.6" created.
本文创建的lv 为 /dev/lvm_pool/centos6.6
三、将qcow2数据同步至lv
# qemu-img convert -p -O raw centos6.6.qcow2 /dev/lvm_pool/centos6.6
等待完成后即可进入下一步
四、使用创建好的lv创建虚拟机
步骤如图所示: