lost and found ( for me ? )

KVM : convert disk format to qcow2 from row image



[root@localhost ~]# uname -ri
3.7.5-201.fc18.x86_64 x86_64
[root@localhost ~]# cat /etc/fedora-release
Fedora release 18 (Spherical Cow)
[root@localhost ~]# qemu-kvm --version
QEMU emulator version 1.2.2 (qemu-kvm-devel), Copyright (c) 2003-2008 Fabrice Bellard
[root@localhost ~]# libvirtd

# qemu-img info ubuntu-1204-vm1.row
image: ubuntu-1204-vm1.row
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 10G

convert
# qemu-img convert -O qcow2 ubuntu-1204-vm1.row ubuntu-1204-vm1.qcow2

[root@localhost KVM_images]# qemu-img info ubuntu-1204-vm1.qcow2
image: ubuntu-1204-vm1.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 2.2G
cluster_size: 65536

[root@localhost KVM_images]# qemu-img check -f qcow2 ubuntu-1204-vm1.qcow2
No errors were found on the image.

edit the VM’s xml file to use the qcow2 image instead of the row image.
# virsh edit ubuntu1204-vm1

before
      <driver name='qemu' type='raw'/>
      <source file='/var/run/media/hattori/fedora-HDD/KVM_images/ubuntu-1204-vm1.row'/>

after
      <driver name='qemu' type='qcow2'/>
      <source file='/var/run/media/hattori/fedora-HDD/KVM_images/ubuntu-1204-vm1.qcow2'/>

start the VM with qcow2.
# virsh start ubuntu1204-vm1
Domain ubuntu1204-vm1 started

virsh # qemu-monitor-command --hmp ubuntu1204-vm1 'info status'
VM status: running

virsh # qemu-monitor-command --hmp ubuntu1204-vm1 'info block'
drive-virtio-disk0: removable=0 io-status=ok file=/var/run/media/hattori/fedora-HDD/KVM_images/ubuntu-1204-vm1.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-ide0-1-0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.