[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt-users] Re-sizing qcow2 images



On 10/27/2012 08:43 PM, Chandana De Silva wrote:
> Hello All,
> 
> I am using Centos 6.3 with libvirt 0.910 and qemu-kvm 0.12
> 
> I had to resize a qcow2 disk, and came across several issues;
> 
> I used this command to resize the image:
> 
> sudo -i /usr/bin/qemu-img /var/lib/libvirt/images/mydisk.img resize
> +100G . The disk is attached using virtio.

Is this while the guest is running, or while it is offline?  NEVER use
qemu-img to modify a disk image while a guest is simultaneously running
on that image, as you risk data loss due to image corruption.

If the guest is running, then 'virsh blockresize' is the only way to
resize the disk in a manner visible to the guest; from there, once the
guest sees the new partition size, then run commands within the guest to
make the file system expand to the new larger partition size (assuming
of course that your file system is one like ext4 that can do online
resizing).  This is also supposing you have new enough libvirt and qemu
to support online resizing (if you don't, then your only solution is
offline resizing, although depending on which disk, you can perhaps
mitigate guest downtime by hotunplugging the disk, doing the resize, and
then hotplugging the disk back in, if that particular disk is not
essential to the guest's operation).

If the guest is offline, then I recommend 'virt-resize' from libguestfs,
rather than trying to use qemu-img yourself.  virt-resize not only knows
how to resize the partitions, but also most file systems residing in
those partitions, which will save you a lot of steps.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]