Moving space with LVM

Hi,

I have an entire physical volume “vg1” that has ~124GB of un-allocated space. There is hardly any space left in my /dev/fedora_localhost-live/home logical volume.

How would I go about moving 60GB from vg1 to /dev/fedora_localhost-live/home, therefore enlarging my home by 60GB. Without losing data.

Any help is appreciated!

[root@localhost ~]# sudo vgs; sudo pvs; sudo lvs
VG                    #PV #LV #SN Attr   VSize   VFree  
fedora_localhost-live   1   3   0 wz--n-  99.59g      0 
vg1                     1   0   0 wz--n- 124.86g 124.86g
PV             VG                    Fmt  Attr PSize   PFree  
/dev/nvme0n1p7 fedora_localhost-live lvm2 a--   99.59g      0 
/dev/nvme0n1p9 vg1                   lvm2 a--  124.86g 124.86g
LV   VG                    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
home fedora_localhost-live -wi-ao---- <30.73g                                                    
root fedora_localhost-live -wi-ao----  62.93g                                                    
swap fedora_localhost-live -wi-ao----   5.93g                                                    
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name               /dev/nvme0n1p9
VG Name               vg1
PV Size               <124.87 GiB / not usable 2.00 MiB
Allocatable           yes 
PE Size               4.00 MiB
Total PE              31965
Free PE               31965
Allocated PE          0
PV UUID               qBu61a-R0Gi-YAo1-n52i-aJL1-6XWx-icFYb7

--- Physical volume ---
PV Name               /dev/nvme0n1p7
VG Name               fedora_localhost-live
PV Size               <99.60 GiB / not usable 3.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              25496
Free PE               0
Allocated PE          25496
PV UUID               SlkUos-ROOb-A8r2-nBk8-ytc5-NNMz-zGBrnh

[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name               vg1
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               124.86 GiB
PE Size               4.00 MiB
Total PE              31965
Alloc PE / Size       0 / 0   
Free  PE / Size       31965 / 124.86 GiB
VG UUID               8qcmDW-nMSC-XA7M-GZUQ-ZiEM-3ytl-zjGcYn

--- Volume group ---
VG Name               fedora_localhost-live
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               3
Max PV                0
Cur PV                1
Act PV                1
VG Size               99.59 GiB
PE Size               4.00 MiB
Total PE              25496
Alloc PE / Size       25496 / 99.59 GiB
Free  PE / Size       0 / 0   
VG UUID               scIlUo-fUMz-53LK-gMxW-Qmp4-0aAX-RJsnqg

[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path                /dev/fedora_localhost-live/swap
LV Name                swap
VG Name                fedora_localhost-live
LV UUID                8waDYN-AzPx-qddH-v1KY-b7TO-PGzI-tstylP
LV Write Access        read/write
LV Creation host, time localhost-live, 2020-04-28 01:09:04 +0100
LV Status              available
# open                 2
LV Size                5.93 GiB
Current LE             1519
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:1

--- Logical volume ---
LV Path                /dev/fedora_localhost-live/home
LV Name                home
VG Name                fedora_localhost-live
LV UUID                cxVG4h-Q8wI-rSm2-dGAL-SwDc-pGvN-Kpg3Fm
LV Write Access        read/write
LV Creation host, time localhost-live, 2020-04-28 01:09:05 +0100
LV Status              available
# open                 1
LV Size                <30.73 GiB
Current LE             7866
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:2

--- Logical volume ---
LV Path                /dev/fedora_localhost-live/root
LV Name                root
VG Name                fedora_localhost-live
LV UUID                eTajTR-THWa-00yZ-FqbR-l7Vp-06Oq-Z3aEYg
LV Write Access        read/write
LV Creation host, time localhost-live, 2020-04-28 01:09:05 +0100
LV Status              available
# open                 1
LV Size                62.93 GiB
Current LE             16111
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:0
1 Like

Does this topic help?

Hi. Yes it gave me some pointers, thank you.

As you can see from my post, I have a volume group in the physical volume that I want to move space from:

VG Name               vg1
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               124.86 GiB
PE Size               4.00 MiB
Total PE              31965
Alloc PE / Size       0 / 0   
Free  PE / Size       31965 / 124.86 GiB
VG UUID               8qcmDW-nMSC-XA7M-GZUQ-ZiEM-3ytl-zjGcYn

Am I to understand that I will have to create a logical volume within that group before I am able to transfer the space within it to /dev/fedora_localhost-live/home?

The second VG has no LVs.
Remove the empty VG and reassign its PV to the main VG.
Then you should be able to extend LV using extra PV space.

2 Likes

Cool.
So I did:

[root@localhost ~]# vgchange -an vg1
  0 logical volume(s) in volume group "vg1" now active
[root@localhost ~]# vgremove vg1
  Volume group "vg1" successfully removed

To remove the volume group. Then to check:

[root@localhost ~]# vgs;
  VG                    #PV #LV #SN Attr   VSize  VFree
  fedora_localhost-live   1   3   0 wz--n- 99.59g    0 
[root@localhost ~]# pvs;
  PV             VG                    Fmt  Attr PSize    PFree   
  /dev/nvme0n1p7 fedora_localhost-live lvm2 a--    99.59g       0 
  /dev/nvme0n1p9                       lvm2 ---  <124.87g <124.87g

And then to assign the physical volume to the volume group I wanted:

[root@localhost ~]# vgextend fedora_localhost-live /dev/nvme0n1p9 
  Volume group "fedora_localhost-live" successfully extended
[root@localhost ~]# vgs;
  VG                    #PV #LV #SN Attr   VSize    VFree  
  fedora_localhost-live   2   3   0 wz--n- <224.46g 124.86g

Thanks!

2 Likes

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