Shrink Qube disk on BTRFS

I found this guide that shows how to shrink the disk of a Qube. Unfortunately, that does not apply when Qubes was installed on BTRFS.

The disk images appear to be located at /var/lib/qubes/appvms/[qube name]. Any idea how to shrink them?

https://www.startpage.com/do/search?q=btrfs+rezise

https://wiki.archlinux.org/title/btrfs#Resizing

https://btrfs.readthedocs.io/en/latest/

See also: man btrfs and then man btrfs-filesystem
The html equivalent below:
https://btrfs.readthedocs.io/en/latest/btrfs-filesystem.html#man-filesystem-resize

spoiler: btrfs filesystem resize.

I don’t use btrfs, so I don’t know how Qubes use filesystem disk and subvolume.
Make sure to do some backup if you got valuable data on the qube.

I don’t want to resize the filesystem Qubes is based on, I want to resize the disk of one of the Qubes (so one of the VMs running within Qubes). Those disks don’t use BTRFS. I’m only mentioning BTRFS, because that’s what stops me from using lvresize. Of course I could resize the disk images, but I assume I need to somehow tell Qubes about this.

The file-reflink storage driver (used for Btrfs) supports shrinking, so it’s simply qvm-volume resize --force instead of sudo lvresize.

But in any case, as the guide repeatedly hints at: You generally should not do this because it will CERTAINLY corrupt the volume data, unless you’ve shrunk the filesystem on the volume first (and that step must not be done in dom0!)

Do this instead:

You can create a new qube, copy your files in to the new qube, and delete the old qube. (Simple and effective.)

1 Like

Thank you, that’s what I was looking for. Yes, I’m aware of the risks, but there’s nothing important in the Qube and I already reduced the filesystem size inside the Qube.

1 Like