xfs_growfs: /dev/ol/root is not a mounted XFS filesystem

On Oracle Linux 7.7, trying to run “xfs_growfs’, and get errors.

[root@racnode1 ~]# xfs_growfs /dev/ol/root
xfs_growfs: /dev/ol/root is not a mounted XFS filesystem

It seems the syntax has been changed for this release. The mount point is required now instead of LV, like /dev/ol/root.

[root@racnode1 ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             4.8G     0  4.8G   0% /dev
tmpfs                2.0G  4.0K  2.0G   1% /dev/shm
tmpfs                4.8G  8.7M  4.8G   1% /run
tmpfs                4.8G     0  4.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root   27G   17G   11G  62% /
/dev/sda1            497M  120M  377M  25% /boot
tmpfs                973M     0  973M   0% /run/user/0
tmpfs                973M     0  973M   0% /run/user/54321
[root@racnode1 ~]# xfs_info /
meta-data=/dev/mapper/ol-root    isize=256    agcount=4, agsize=1734656 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0 rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=6938624, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=3388, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@racnode1 ~]#  xfs_growfs /
meta-data=/dev/mapper/ol-root    isize=256    agcount=4, agsize=1734656 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0 rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=6938624, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=3388, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 6938624 to 15974400

We can confirm root file system (/) size has been increased from 27GB to 61GB.

[root@racnode1 ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             4.8G     0  4.8G   0% /dev
tmpfs                2.0G  4.0K  2.0G   1% /dev/shm
tmpfs                4.8G  8.7M  4.8G   1% /run
tmpfs                4.8G     0  4.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root   61G   17G   45G  27% /
/dev/sda1            497M  120M  377M  25% /boot
tmpfs                973M     0  973M   0% /run/user/0
tmpfs                973M     0  973M   0% /run/user/54321

How to Increase Linux Swap Logical Volume ( LVM ) Size

Check which Volume Group ( VG) the swap LV is using.

[root@racnode1 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/ol/swap
LV Name swap
VG Name ol
LV UUID epJhR9-0sM6-bK6L-qubv-lrJb-0P0X-2Ab5fD
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-11-24 00:34:14 +1100
LV Status available
# open 2
LV Size 3.00 GiB
Current LE 768
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 252:1

Make sure VG ol has enough free space for swap LV to extend.

[root@racnode1 ~]# vgdisplay
--- Volume group ---
VG Name ol
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 95.50 GiB
PE Size 4.00 MiB
Total PE 24449
Alloc PE / Size 7544 / <29.47 GiB
Free PE / Size 16905 / <66.04 GiB
VG UUID 55lr8l-8d38-GGIX-j0Cm-InKP-Jiyb-refLmt

Disable swapping for the associated logical volume.

[root@racnode1 ~]# swapoff -v  /dev/ol/swap
swapoff /dev/ol/swap

[root@racnode1 ~]# free -g
              total   used      free   shared  buff/cache   available
Mem:              9      0         9        0           0           9
Swap:             0      0         0
[root@racnode1 ~]#

Resize the logical volume. I’m going to increase the swap volume from 3G to 8G .

[root@racnode1 ~]# lvresize /dev/ol/swap -L +5G --test
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Size of logical volume ol/swap changed from 3.00 GiB (768 extents) to 8.00 GiB (2048 extents).
  Logical volume ol/swap successfully resized.
[root@racnode1 ~]# lvresize /dev/ol/swap -L +5G
  Size of logical volume ol/swap changed from 3.00 GiB (768 extents) to 8.00 GiB (2048 extents).
  Logical volume ol/swap successfully resized.

Format the new swap space.

[root@racnode1 ~]# mkswap /dev/ol/swap
mkswap: /dev/ol/swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 8388604 KiB
no label, UUID=3bfcff72-20c3-4e1e-ad38-20de7cca2050
[root@racnode1 ~]#

Enable the extended logical volume.

[root@racnode1 ~]# swapon -va
swapon /dev/mapper/ol-swap
swapon: /dev/mapper/ol-swap: found swap signature: version 1, page-size 4, same byte order
swapon: /dev/mapper/ol-swap: pagesize=4096, swapsize=8589934592, devsize=8589934592
[root@racnode1 ~]#

Test that the logical volume has been extended properly.

[root@racnode1 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              9           0           9           0           0           9
Swap:             7           0           7
[root@racnode1 ~]# cat /proc/swaps
Filename                  Type            Size    Used    Priority
/dev/dm-1                 partition       8388604 0       -2
[root@racnode1 ~]#

Only one VG ( ol ).

[root@racnode1 ~]# vgdisplay
--- Volume group ---
VG Name ol
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 95.50 GiB
PE Size 4.00 MiB
Total PE 24449
Alloc PE / Size 8824 / <34.47 GiB
Free PE / Size 15625 / <61.04 GiB
VG UUID 55lr8l-8d38-GGIX-j0Cm-InKP-Jiyb-refLmt

Two LVs ( swap, root)

[root@racnode1 ~]# lvdisplay

--- Logical volume ---
LV Path /dev/ol/swap
LV Name swap
VG Name ol
LV UUID epJhR9-0sM6-bK6L-qubv-lrJb-0P0X-2Ab5fD
LV Write Access read/write
LV Creation host,time localhost.localdomain,2015-11-24 00:34:14 +1100
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 3
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 252:1

--- Logical volume ---
LV Path /dev/ol/root
LV Name root
VG Name ol
LV UUID N0D1Hr-FbhE-R7rt-WuUX-9PQU-jVfH-eF5UtL
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-11-24 00:34:14 +1100
LV Status available
# open 1
LV Size <26.47 GiB
Current LE 6776
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 252:0

VG ( ol) combines with two PVs ( /dev/sda2, /dev/sda3)

[root@racnode1 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name ol
PV Size 29.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7554
Free PE 0
Allocated PE 7554
PV UUID ifffmk-GSXU-NcKC-vww1-HMF6-Nc36-A6sewK

--- Physical volume ---
PV Name /dev/sda3
VG Name ol
PV Size 66.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 16895
Free PE 15625
Allocated PE 1270
PV UUID DG6gQe-VQki-1oT2-V1wk-1etX-6qkp-7QP3cX

[root@racnode1 ~]#