All steps to reduce qubes_dom0 volume group

I’m new to lvm & lvm2 and although I understand the architecture and objectives of lvm, although how to use the commands to achieve a result is proving to be difficult to grasp.

Just upgraded to qubes 4. I have a single gdb hdd of 2tb. System tray says I’m using < 200GB of space for everything. I want to condense everything into a 300GB partition, leaving 1.7TB totally free.

I have backed up all of my qubes so I am ready to do this.

Ought to be a way to reduce the size of qubes_dom0 without needing to install more space to temporarily move extents around but I’m sure there is more than 1 way to accomplish this.

Easy way is best way for this guy. If it makes the task easier and/or faster by adding another 500GB ssd as a temporary device I can do that too.

Physical layout as installer partitioned the drive is:

/dev/sda1             eft
/dev/sda2             boot
/dev/sda3             luks-->lvm       (all remaining space)

Within the lvm (pvs -v --segments /dev/luks-xxxxxxxx):

 Start                Size         PExtents Start               End             Name
     0                440                       0               439             lvol0_pmspare
   440                442347                  440               442786          pool00_tdata
442787                440                  442787               443226          pool00_meta
443227                7848                 443227               451074          swap
451075                25600                                                     free

What I want is:

  Start                Size        PExtents Start               End              Name
      0                440                      0               439              lvol0_pmspare
    440                80000                  440               77560            pool00_tdata
  78000                80                   78000               78079            pool00_meta
  78080                4000                 78080               82079            swap
  82080                476675                                                    free

I reduced the size of the pool00_meta proportionally to the reduction of pool00_tdata, and swap by almost half (just don’t need that much). Left the 1st LV (spare) same size. No change to ordering of volumes.

I thought about just wiping the disk and installing from USB where I could dictate only using the first 300GB of space of the hdd, however if lvm is so great at space allocation it shouldn’t take a ton of effort to accomplish this without becoming an lvm expert. It should also be possible to do this live (all but luks resize) I haven’t found good examples online that have helped me figure out how to go about this.

From my research reducing the luks container is the last step, but the physical extents in vg pool00 within it must be reduced and to do that the swap must be moved “down”.

Can the swap be relocated (and resized) live?

When I do an lvsdisplay (I believe that was the command I used) the list of extents used for the 50+ logical volumes al looked to be back to back. In other words I should be able to move (pvmode I presume, tho the argument values I need are confusing to me) the swap to it’s target destination by removing N physical extents between the last extent used by the appVM LVs and where the stack should start.

The last step in lvm is to free the unused extents.

I haven’t seen any, but I suspect there are gui tools that call lvm to help make this easier. Problem is they need to run in dom0 and that is just not wise.