How do I remove from and extend a LVG?

I have a Rocky 9 install.
I have just moved it (clonezilla) from a 500gb SSD to a 1TB nvme

in addition, I have used the old 500gb SSD as the new /home location. This has worked ok.
So I now should have approx 500gb ‘free’ on my new nvme but I dont see it yet because the cloning from 500gb

but two problems:

  1. I still have the old /home partition in the LVG, which I want to delete
  2. and then increase the size of root & swap to take advantage of the freed up space.
    I need a little more space for swap and the rest for /root

But navigating lvms is a bit confusing. gone are the good old gparted days

anyway, here is my drive: lsblk

nvme1n1 259:5 0 931.5G 0 disk
├─nvme1n1p1 259:6 0 600M 0 part /boot/efi
├─nvme1n1p2 259:7 0 2.6G 0 part /boot
└─nvme1n1p3 259:8 0 928.3G 0 part
├─rl00-root 253:0 0 70G 0 lvm /
├─rl00-swap 253:1 0 4G 0 lvm [SWAP]
└─rl00-home 253:2 0 390.2G 0 lvm

vgdisplay rl00

— Volume group —
VG Name rl00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 464.17 GiB
PE Size 4.00 MiB
Total PE 118828
Alloc PE / Size 118828 / 464.17 GiB
Free PE / Size 0 / 0
VG UUID 5KQurn-zq7d-Efpo-0i5w-OFf

vgs

VG #PV #LV #SN Attr VSize VFree
rl00 1 3 0 wz–n- 464.17g 0

lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home rl00 -wi-a----- 390.17g
root rl00 -wi-ao---- 70.00g
swap rl00 -wi-ao---- 4.00g

pvs

PV VG Fmt Attr PSize PFree
/dev/nvme1n1p3 rl00 lvm2 a-- 464.17g 0

so my questions are:

  1. how do I remove /home from the rl00 vg
  2. how do take this space and extend the rl00 to use both the extra 500gb from the nvme AND the 390gb from the deleted /home
  3. how do I then increase the size of swap by 10gb and the rest to root?

First, the nvme1n1 has three (GPT) partitions. Probably consecutive, i.e. unallocated space is “after” the third partition.

The third partition has a PV. You could update the partition table to move the end of third partition “forward” (with gdisk). I probably would boldly remove the third partition and create new that has differs only by the “end sector”. (You can’t do that from running system, but you can boot the install media to “rescue”.)

Once the partition is larger, it should be possible to use pvextend to tell the PV that it has more space to occupy.


If you do have a LV that you don’t use nor need, there is lvremove.

The swap I would take out of use, remove the LV, and later create larger.

When the rl00/root is the only LV, you can look with lvdisplay whether it starts from beginning of the VG (from extent 0). If not, then there is pvmove.

There is lvextend that takes option --resizefs. It will both change the size of the LV and after that expand the filesystem within the LV.


However, I would neither allocate all space from a disk, nor extend the / volume. Even 70g is way too much, IMHO. I rather create additional volumes and mount them where extra space is required.

Rationale? The / contains primarily files from packages. Those can always be reinstalled. The directories that might contain actual data, for example the /var/www, are better off in separate volumes. Then they can’t fill the / accidentally. (There is probably also config, like firewall customizations, but those are better to have in a format that is easy to redeploy.) The result is that the / is small and trivial to wipe and repopulate; user data is elsewhere. If you have a behemoth / and have to reinstall, then you have to restore all your data from backups.

1 Like

thanks for the reply

my “data” is all elsewhere on a different file system. I dont keep any data/work etc on /

what IS on / though, are all my applications (/usr/local/x /opt/x etc etc) and some of them can take up quite a large amount of space.

In addition a good sized swap is needed by things like vmware (which needs at least 18gb)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.