resizing lvm

General support questions
Post Reply
Ofloo
Posts: 2
Joined: 2021/04/15 10:32:28

resizing lvm

Post by Ofloo » 2021/04/15 10:37:39

For some reason I can't get my disk resized.

Code: Select all

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/mapper/luks-7092fa8a-483e-468f-a37d-0d1d85a8a787
  VG Name               centos
  PV Size               49,31 GiB / not usable <3,05 MiB
  Allocatable           NO
  PE Size               4,00 MiB
  Total PE              12623
  Free PE               7680
  Allocated PE          4943
  PV UUID               wwIykd-qGlf-S3li-lLKR-pulj-lZC9-MVFWh3

Code: Select all

  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <49,31 GiB
  PE Size               4,00 MiB
  Total PE              12623
  Alloc PE / Size       4943 / <19,31 GiB
  Free  PE / Size       7680 / 30,00 GiB
  VG UUID               WKa01s-nMng-67XP-JVfA-2JWB-mRmY-n1pyGv

Code: Select all

# lvresize -l100%FREE /dev/mapper/centos-root
  Size of logical volume centos/root unchanged from <18,31 GiB (4687 extents).
  Logical volume centos/root successfully resized.

Code: Select all

# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <18,31g                                                    
  swap centos -wi-a-----   1,00g 

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: resizing lvm

Post by TrevorH » 2021/04/15 13:38:40

man lvresize

Make sure you use lvresize -r to resize the filesystem at the same time as the LV.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: resizing lvm

Post by jlehtone » 2021/04/15 14:38:41

Code: Select all

[code]lvresize -l100%FREE /dev/mapper/centos-root
[/code]
Isn't that same as lvresize -l 7680 centos/root? That is: set size to 30 GiB.
Since LV has now 4687 extents, the equivalent "add" command would be: lvresize -l +2993 centos/root

Not that it explains why nothing happens.

Trevor is right: you should have the -r option too to get the filesystem resize auto-magickally.


I would suspect the "Allocatable":
Ofloo wrote:
2021/04/15 10:37:39

Code: Select all

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/mapper/luks-7092fa8a-483e-468f-a37d-0d1d85a8a787

  Allocatable           NO
https://serverfault.com/questions/23897 ... machine-ca

Ofloo
Posts: 2
Joined: 2021/04/15 10:32:28

Re: resizing lvm

Post by Ofloo » 2021/04/18 19:23:15

indeed the Allocatable was the issue:

Code: Select all

#pvchange -x y /dev/mapper/luks-7092fa8a-483e-468f-a37d-0d1d85a8a787
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/mapper/luks-7092fa8a-483e-468f-a37d-0d1d85a8a787
  VG Name               centos
  PV Size               49,31 GiB / not usable <3,05 MiB
  Allocatable           yes 
  PE Size               4,00 MiB
  Total PE              12623
  Free PE               4687
  Allocated PE          7936
  PV UUID               wwIykd-qGlf-S3li-lLKR-pulj-lZC9-MVFWh3
#lvresize -r -l100%FREE /dev/mapper/centos-root ;# just incase added -r as suggested, however without the Allocatable didn't work
#xfs_growfs /dev/centos/root
# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                6CI36y-4zCd-T3ow-y1BN-jKGM-IuDg-peGNCW
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-09-13 14:16:57 +0200
  LV Status              available
  # open                 0
  LV Size                1,00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                H6QKGK-ri7b-vUZV-zHUc-Ufee-vdqb-0j0qXT
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-09-13 14:16:57 +0200
  LV Status              available
  # open                 1
  LV Size                30,00 GiB
  Current LE             7680
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Post Reply