0

I want to extend my logical volume mounted to /home:

lsblk
NAME                     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                       11:0    1 1024M  0 rom
xvda                     202:0    0  125G  0 disk
├─xvda1                  202:1    0  500M  0 part /boot
└─xvda2                  202:2    0 74.5G  0 part
  ├─centos_jenslv05-root 253:0    0   48G  0 lvm  /
  ├─centos_jenslv05-swap 253:1    0    3G  0 lvm  [SWAP]
  └─centos_jenslv05-home 253:2    0 23.5G  0 lvm  /home

As you can see xvda has 125GB and xvda1 + xvda2 have only 75GB combined. The extra 50GB is what i want to add to centos_jenslv05-home logical volume.

PVS

pvs
  PV         VG              Fmt  Attr PSize  PFree
  /dev/xvda2 centos_jenslv05 lvm2 a--  74.51g    0

VGS

vgs
  VG              #PV #LV #SN Attr   VSize  VFree
  centos_jenslv05   1   3   0 wz--n- 74.51g    0

LVS

lvs
  LV   VG              Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos_jenslv05 -wi-ao---- 23.45g
  root centos_jenslv05 -wi-ao---- 48.04g
  swap centos_jenslv05 -wi-ao----  3.02g

So basically i need to extend the partition dev/xvda2, add it to the PV, add it to VG and then to LVM which is mounted to home.

However, i don't want to loose data on root lv (/), which is on the same partition as the home lv (/home). Is there a way to extend only one logical volume, without touching other lvs? If it's not possible and i need to delete the partition and then recreate it with added space, will backing up all the files on /root and /home be enough? Can i recreate parition, then recreate lvs and copy the files back to lvs and will it start the server as it was? Is it safe?

I know that extending logical volume without touching others is possible on Windows, but not sure if it's as handy on Linux. The system is Centos 7.

marked as duplicate by Stephen Kitt linux May 31 at 18:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

There is a guide here explaining your 2 options.

Either

  1. Extend the existing pv with gparted, resize the vg with vgextend /dev/xda2 and then extend your lv.

Or

  1. Add a new pv by creating a new volume (xda3) in the unused space on xda, add the new partition to the vg and then extend the lv into the new space.

in either case you will need to resize your file-system to make the capacity available but you can do this using lvextend -r when you resize.

Looking at your partition schema, the free space will be contiguous with xda2 and either option is viable though option 1 is the more aesthetically pleasing (see @Patrick post in the above link).

Since you are not actually touching the root (logical) partition then you should be able to do this from your live system. If not then you will need a live usb.

Not the answer you're looking for? Browse other questions tagged or ask your own question.