Mailing List Archive

RAW / Qcow disk image online resizing
Hello,

Is it possible to expand the disk capacity of a domU that uses a RAW or
Qcow disk image?

I usually do this with domUs whose disks are LVM volumes using lvextend
from the dom0 and then resize2fs from the domU.

But when I extend a RAW or Qcow image with qemu-img extend, the new disk
size is not propagated to the domU until the next reboot.

Thank you

Regards,

--
Charles
Re: RAW / Qcow disk image online resizing [ In reply to ]
I found from
https://documentation.suse.com/fr-fr/sles/12-SP5/html/SLES-all/cha-xen-admin.html#sec-xen-config-sparse
that we can propagate the new size of a RAW image with losetup.

First detect the correct loop device with the command:


losetup -j /path/to/disk.img


Then resize the loop device, for example /dev/loop0, with the following
command:


losetup -c /dev/loop0


But I have not yet found an equivalent for Qcow.

Regards,

Le mar. 21 déc. 2021 à 13:34, Charles Koprowski <charles@koprow.ski> a
écrit :

> Hello,
>
> Is it possible to expand the disk capacity of a domU that uses a RAW or
> Qcow disk image?
>
> I usually do this with domUs whose disks are LVM volumes using lvextend
> from the dom0 and then resize2fs from the domU.
>
> But when I extend a RAW or Qcow image with qemu-img extend, the new disk
> size is not propagated to the domU until the next reboot.
>
> Thank you
>
> Regards,
>
> --
> Charles
>


--
Charles
Re: RAW / Qcow disk image online resizing [ In reply to ]
Charles, you didn't say if the image is the boot image or an external device that's mounted by the VM. If it's the boot image
I am almost sure you have to reboot when you extend the qcow2--actually whenever I've done it I've actually shut down before
even growing the qcow2 image and resizing the file system. Note I haven't been running Xen for quite some time and there might be new features now of which I am unaware, but as far as I know it doesn't depend on the hypervisor you are using, KVM has same issue.

Steve Timm.
________________________________
From: Xen-users <xen-users-bounces@lists.xenproject.org> on behalf of Charles Koprowski <charles@koprow.ski>
Sent: Thursday, December 23, 2021 5:45 AM
To: xen-users@lists.xen.org <xen-users@lists.xen.org>
Subject: Re: RAW / Qcow disk image online resizing

I found from https://documentation.suse.com/fr-fr/sles/12-SP5/html/SLES-all/cha-xen-admin.html#sec-xen-config-sparse<https://urldefense.proofpoint.com/v2/url?u=https-3A__documentation.suse.com_fr-2Dfr_sles_12-2DSP5_html_SLES-2Dall_cha-2Dxen-2Dadmin.html-23sec-2Dxen-2Dconfig-2Dsparse&d=DwMFaQ&c=gRgGjJ3BkIsb5y6s49QqsA&r=10BCTK25QMgkMYibLRbpYg&m=ix07NrwOtRUZnRFfrJjACcARGhXJwHDmOZ3OpWMdH3U77ktazLwYRmkSJrTtDLCQ&s=TD2gsTuSfmd5WGv-boCo-FxiPktoRguWOVFt0xQWNmA&e=> that we can propagate the new size of a RAW image with losetup.

First detect the correct loop device with the command:

losetup -j /path/to/disk.img

Then resize the loop device, for example /dev/loop0, with the following command:

losetup -c /dev/loop0

But I have not yet found an equivalent for Qcow.

Regards,

Le mar. 21 d?c. 2021 ? 13:34, Charles Koprowski <charles@koprow.ski> a ?crit :
Hello,

Is it possible to expand the disk capacity of a domU that uses a RAW or Qcow disk image?

I usually do this with domUs whose disks are LVM volumes using lvextend from the dom0 and then resize2fs from the domU.

But when I extend a RAW or Qcow image with qemu-img extend, the new disk size is not propagated to the domU until the next reboot.

Thank you

Regards,

--
Charles


--
Charles
Re: RAW / Qcow disk image online resizing [ In reply to ]
Hello,

On Thu, Dec 23, 2021 at 02:50:31PM +0000, Steven C Timm wrote:
> qcow2--actually whenever I've done it I've actually shut down
> before even growing the qcow2 image and resizing the file system.
> Note I haven't been running Xen for quite some time and there
> might be new features now of which I am unaware, but as far as I
> know it doesn't depend on the hypervisor you are using, KVM has
> same issue.

I can certainly resize a domU's root filesystem without rebooting
it, no problem, but I only use LVM-backed block devices as VM disks
so have no idea how it is done with any other kind of backend, or if
it can be.

Cheers,
Andy