Extending a Logical Volume on RHEL7

时间:2019-01-18 19:07:34

标签: rhel7 lvm

I am using a RHEL7 box, created by our in-house vm-provisioning system.

They create logical volumes for the likes of /var, /home, swap etc. using 2 pools of space. I was attempting to follow the examples and descriptions of how to add some of that un-allocated space to a volume from https://www.tecmint.com/extend-and-reduce-lvms-in-linux/, and am stuck getting 'resize2fs' to operate as expected.

using lvdisplay - I got the appropriate volume:

      --- Logical volume ---
  LV Path                /dev/rootvg/lvvar
  LV Name                lvvar
  VG Name                rootvg
  LV UUID                WGkYI1-WG0S-uiXS-ziQQ-4Pbe-rv1H-0HyA2a
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-06-05 16:10:01 -0400
  LV Status              available
  # open                 1
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:5

I found the associated volume group with vgdisplay:

  --- Volume group ---
  VG Name               rootvg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                7
  Open LV               7
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <49.00 GiB
  PE Size               4.00 MiB
  Total PE              12543
  Alloc PE / Size       5120 / 20.00 GiB
  Free  PE / Size       7423 / <29.00 GiB
  VG UUID               5VkgVi-oZ56-KqMk-6vmf-ttNo-EMHG-quotwk

I decided to take 4G from the Free PE's and extended the space with:

lvextend -l +1024 /dev/rootvg/lvvar

which answered as expected:

  Size of logical volume rootvg/lvvar changed from 2.00 GiB (512 extents) to 6.00 GiB (1536 extents).
  Logical volume rootvg/lvvar successfully resized.

But when I try to use resize2fs - I get this:

# resize2fs /dev/mapper/rootvg-lvvar
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/rootvg-lvvar

I'm sure it's something dumb I'm missing - can anyone push me in the right direction here?

1 个答案:

答案 0 :(得分:0)

改为使用xfs_growfs。

xfs_growfs /dev/mapper/rootvg-lvvar