Environment
- Red Hat Enterprise Linux (RHEL) 5, 6, 7, 8
- Logical Volume Manager (LVM) 2
Issue
- What is the procedure to grow an existing filesystem based on Logical Volume?
- How can I extend my logical volume and the filesystem in the command line?
- I have extended a logical volume using
lvextend
which shows the extension in volume groupvgdisplay
butdf
isn't reflecting the size, am I missing anything? - How do I grow an ext3/ext4/XFS filesystem on LVM?
- How do I increase my filesystem on the fly, without unmounting it ?
- We are using LVM for mounting the filesystem, how can we use the
lvextend
command to extend the volume group and increase the filesystem size? - What are the steps to extend a filesystem after a LUN capacity has been extended?
- What is the procedure to increase the size of an LVM2 logical volume and resize its filesystem?
- I need to expand a filesystem created on LVM partition, does the filesystem need to be unmounted when expanding it or can I resize it online?
- How to grow an ext filesystem with
pvcreate
,vgextend
,lvextend
andresize2fs
commands - How to grow an XFS filesystem with
pvcreate
,vgextend
,lvextend
andxfs_growfs
commands - I have extended the logical volume size with
lvextend
command but the size of the file system its not reflecting this change
Resolution
Warning: Red Hat recommends that all critical data be backed up and verified before making any changes to the underlying storage as an unforeseen problem might occur.
The following are sample steps to extend a Volume Group (VG
), a Logical Volume (LV
), and a filesystem using a device named /dev/sdN
as its Physical Volume (PV
).
Create a
PV
from a free disk or partition (e.g./dev/sdN1
as a partition):# pvcreate /dev/sdN1
Extend the
VG
(/dev/sdN1
is an existingPV
path):# vgextend vgdata /dev/sdN1
Extend the
LV
and resize the underlying filesystem together (/dev/vgdata/lvdata
is the existingLV
path), which will be extended by 125 GB:# lvextend -r -L +125G /dev/vgdata/lvdata
If the filesystem you are extending is a GFS filesystem, refer to How do I grow a GFS2 file-system on RHEL?.
If unpartitioned disk space is being added to an existing
VG
to extend aLV
and the corresponding file system, refer to How to Increase the Size of an LVM2 Logical Volume.
Root Cause
Logical Volume Manager 2 (LVM2) allows you to aggregate physical storage devices into volume groups. You can then divide that aggregated space into one or more logical volumes.
Once created, logical volumes can be extended to utilize unused space within the volume group, allowing the file system residing on the logical volume to be extended as well. However, if all of the physical storage in a volume group is already occupied by logical volumes, then more physical volumes must be added before the logical volume can be extended.
Note: if you have not run resize2fs
or xfs_growfs
on the block device after extending the Logical Volume you will see the file system size as the same as before extending it. In order to use the extended space on the LVM run resize2fs
or xfs_growfs
to fill up the partition with the existing file system. After resizing the file system you will now be able to see the extended size of the file system in df
command output.
Diagnostic Steps
- See the following man pages and manuals:
- man pvcreate 8
- man vgextend 8
- man lvextend 8
- man resize2fs 8
- man xfs_growfs 8
- Red Hat Enterprise Linux 5 Logical Volume Manager Administration LVM Administrator's Guide
- Red Hat Enterprise Linux 6 Logical Volume Manager Administration LVM Administrator's Guide
- Red Hat Enterprise Linux 7 Logical Volume Manager Administration LVM Administrator's Guide
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.