New to Linux Fileservers and trying to extend /dev/mapper/centos-root
This is a test server

The Logical Volume /dev/centos/root is 27.99GB large:

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID pTluxe-mE75-6X38-DVUa-QjkH-fCTg-odhdzY
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 13:08:05 +0200
LV Status available
# open 1
LV Size 27.99 GiB
Current LE 7166
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

But the filesystem /dev/mapper/centos-root is only 18G big

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 18G 2.0G 17G 11% /
devtmpfs 192M 0 192M 0% /dev
tmpfs 204M 0 204M 0% /dev/shm
tmpfs 204M 5.0M 199M 3% /run
tmpfs 204M 0 204M 0% /sys/fs/cgroup
/dev/sda1 1014M 129M 885M 13% /boot
tmpfs 41M 0 41M 0% /run/user/1000

resize2fs returns the following error:

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

  • 2
    The default filesystem in 7 is xfs, not ext2/3/4. If yours is using xfs, you need to use xfs_growfs, not resize2fs.
    – user143703
    Oct 4, 2018 at 18:16
  • That's right, it works by using xfs_growfs /dev/mapper/centos-root Oct 5, 2018 at 8:16
  • 1
    You also might consider using --resizefs in your lvextend command.
    – Thomas
    Oct 5, 2018 at 8:42

2 Answers 2


Thomas's note about --resizefs really needs to be an answer. You can do both LV size change and file system extend in one command:

lvextend -r --size 28g /dev/centos/root

Just the file system part is also exposed as the fsadm command, which you can run on both ext and xfs file systems.

  fsadm resize /dev/centos/root

Thomas' & John's command is indeed the fastest.

To extend the Logical Volume and Filesystem at the same time:
lvextend -L +5G --resizefs /dev/centos/root

To extend the Logical Volume separately:
lvextend -L +5G /dev/centos/root

To extend the Filesystem separately:
xfs_growfs /dev/centos/root

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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