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. I then tried to use parted from within the guest to resize the partition. The first problem was that the guest os did not see the increase disk size. Is there something that I need to do, to force the guest to see the higher disk size ? I got round this by re-starting the guest, but it would be better if there is some way to force the guest to see the new size. The second problem was that parted gave an error : Error: Filesystem has an incompatible feature enable. Some reading showed that this was caused by the "resize_inode" feature on the file system. I removed this feature using debugfs, and rans fsck, but parted still gave the same error: Error: Filesystem has an incompatible feature enable. I would like some advice on how this is supposed to be done. Thanks in advance. Chandana
Hi, If you have a spare guest you may consider temporarily attaching the said cow2 image to that guest and use the partition tools (like parted , fdisk,cfdisk etc) and filesystem tools (like xfs_grow , resize2fs etc) to grow the filesystem. use partprobe to reread the partition table into the kernel once partition editing tools are used. re-read of mounted root partions mostly do not work for me. hence i suggested using a separte vm for the image. Regards, Rajesh Kumar Mallah Tel. 91-11-46710500 (Ext:303) Cell +919811255597 Website: http://www.tradeindia.com/ \|/ \|/ \|/ stop printing \|/ \|/ \|/ | | | start planting | | | ----- "Chandana De Silva" <chandana at desilva.id.au> wrote: | From: "Chandana De Silva" <chandana at desilva.id.au> | To: libvirt-users at redhat.com | Sent: Sunday, October 28, 2012 8:13:50 AM | Subject: [libvirt-users] Re-sizing qcow2 images | | 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. | | I then tried to use parted from within the guest to resize the | partition. | | The first problem was that the guest os did not see the increase disk | size. | Is there something that I need to do, to force the guest to see the | higher disk size ? | I got round this by re-starting the guest, but it would be better if | there is some way to force the guest to see the new size. | | The second problem was that parted gave an error : Error: Filesystem | has | an incompatible feature enable. | Some reading showed that this was caused by the "resize_inode" feature | | on the file system. I removed this feature using debugfs, and rans | fsck, | but parted still gave the same error: Error: Filesystem has an | incompatible feature enable. | | I would like some advice on how this is supposed to be done. | | Thanks in advance. | | Chandana | | | _______________________________________________ | libvirt-users mailing list | libvirt-users at redhat.com | https://www.redhat.com/mailman/listinfo/libvirt-users
----- "Chandana De Silva" <chandana at desilva.id.au> wrote: | From: "Chandana De Silva" <chandana at desilva.id.au> | To: "Rajesh Kumar Mallah" <mallah at tradeindia.com> | Cc: libvirt-users at redhat.com | Sent: Sunday, October 28, 2012 3:35:05 PM | Subject: Re: [libvirt-users] Re-sizing qcow2 images | | Hello Rajesh, | | Thanks for the the suggestions. | | | On 28/10/12 17:43, Rajesh Kumar Mallah wrote: | > If you have a spare guest you may consider temporarily attaching the | said cow2 image to that guest | Do you mean detach from guest A and attach to guest B ? Yes. | > and use the partition tools (like parted , fdisk,cfdisk etc) | > and filesystem tools (like xfs_grow , resize2fs etc) to grow the | filesystem. | Assuming it will be possible to detach and attach, I still have the | problem of parted giving the incompatible feature error. These disk | have GPT partitions so I can use fdisk I am not sure about the "incompatible feature error" . May be you could try fdisk or cfdisk. It is usually a good idea to "free" the device before doing partition resizes. We had done it (resizing cow2) once and it was successful , we had to although convert from cow2 to raw , append a new dd'ed file and user fdisk over the raw image. eventually it worked. what is the size of your cow2 device if its not huge you may consider backing it up and restore to a larger device. hope it helps. mallah.
On 10/28/2012 04:43 AM, 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.For my resizes I use libguestfs's virt-resize [1] tool. It's been working flawlessly so far -- it resizes both the image file/device and partitions inside that image. I can't recommend it enough. Best, Hristo [1] http://www.libguestfs.org/virt-resize.1.html
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 at redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 617 bytes Desc: OpenPGP digital signature URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20121029/f961cf7b/attachment.sig>
Hello Hristo, Thanks for your comments. I was really looking for an on-line resizing tool. Eric Blake's later response seem to cover this. Regards Chandana On 30/10/12 03:00, Hristo Deshev<hristo at deshev.com>> For my resizes I use libguestfs's virt-resize [1] tool. It's been > working flawlessly so far -- it resizes both the image file/device and > partitions inside that image. I can't recommend it enough. > > Best, > Hristo