Guide how to increase `dom0` free disk space to avoid problems with big templates and backups

Guide how to increase dom0 free disk space to avoid problems with big templates and backups

This guide was checked for R4.2.

It can be done in the running Qubes R4.2 system without data-loss.
But make full backups before doing anything, in case something goes wrong.

All steps are done in the dom0 Terminal:

  1. First check that you have empty space in your Volume Group qubes_dom0.
    Qubes OS installer keeps 10% free by default, so in most cases you will have this space
    $ sudo vgs qubes_dom0
    Check the last column (VFree). It can say something like “<50.44g”, it would mean you have a bit more than 50 GiB of free space.
    Note: that the less sign “<” before size (like in "<50.44g") only tells you how the value was mathematically rounded. It does not mean that the free size can be much smaller than the value (e.g. it is for sure bigger than 50 GiB in this case).

  2. Check the current size of root-pool pool logical volume just to know:
    $ sudo lvdisplay qubes_dom0/root-pool
    The “LV Size” would have something like 25.00 GiB or something in default case.

  3. Add additional space, e.g. 20 GiB to the root-pool pool logical volume.
    $ sudo lvextend --size +20G qubes_dom0/root-pool
    Remember, additional space should be smaller than VFree of Volume Group qubes_dom0.

  4. Add the same amount of space (or a bit less if you want to have reserve) to the root logical volume that is located inside root-pool pool.
    $ sudo lvextend --size +20G qubes_dom0/root

  5. Finally resize ext4 filesystem or root partition in dom0 to occupy the new increased size:
    $ sudo resize2fs /dev/mapper/qubes_dom0-root

Now the Qubes Disk Space Monitor widget in system tray, and df -h in dom0’s terminal should show you the increased size of root partition (/) in dom0.

3 Likes

Any chance, that you can explain -in a second step- how to add a second drive (ssd/hdd) to the qubes_dom0 space ? Thats something I really been curious about, cause I’m having a 1TB m.2 for the entire system installed here and another 512GB m.2 is lying around in the device without any further use…

BTW: thanks for your step-by-step guide…

1 Like

It’s not related to dom0 free space, so it’s probably not a good idea to discuss it here.

None the less, you can add this ssd as Physical Volume to LVM and extend Volume Group qubes_dom0 by 512 GB. It also can be done on-fly (on running system), as I understand.

I personally would not do that, because it decreases the reliability of the setup. If any of your ssd dies, the data on the second one could be lost, too.

If you want to use this additional space only in some particular big qubes, I would advice paritioning the second ssd and attach partitions to these qubes. You may consider encryption, too.

1 Like

@balko

$ sudo vgs qubes_dom0
Check the last column (VFree).

Shows ‘0’.

  1. Check the current size of root-pool pool logical volume just to know:
    $ sudo lvdisplay qubes_dom0/root-pool
user@dom0:~ > sudo lvdisplay qubes_dom0/root-pool
  Failed to find logical volume "qubes_dom0/root-pool"

Here’s a guide: Add new device to the default `vm-pool`

Omit the last step (lvextend) if you just want to add your drive to the qubes_dom0 volume group without extending any existing volumes.

p.s. balko is right that this harms the reliability

What Qubes OS version do you have? Did you do manual partitioning during installation?

@balko

What Qubes OS version do you have?

4.2.4

Did you do manual partitioning during installation?

It was a long time ago. I only remember I left some unpartitioned space for over-provisioning and I think I just selected the rest for the installation.

df -h shows me I have:

/dev/mapper/qubes_dom0-root for /
/dev/nvme0n1p2 for /boot
/dev/nvme0n1p1 for /boot/efi

Information about pools is available in LVM output, not df/mount.
Try sudo lvs and check where is root logical volume located.

Maybe, you made inplace upgrade from R4.1? Because in R4.1 partitioning was different.

Try sudo lvs and check where is root logical volume located.

It’s in pool00.

Maybe, you made inplace upgrade from R4.1?

Yes.

Because in R4.1 partitioning was different.

What is the difference?

Instead of pool00 the root volume that is located in its own root-pool. In R4.2 there is no pool00, and root is not in the same pool as other qubes.
You can compare installer scripts in git repo for related commands.

Thanks for explaining. So, using the right name in step 2 now works.
But why does VFree from step 1 show 0?