If you are running out of space and you want to add more space to your LVM volume, you can use the lvresize command to do so. To do that, unmount the volume and use the lvresize command. (Actually, it is not required that you unmount the volume to grow it, but it is done as an extra precaution.) After that, you must also check the filesystem with e2fsck and run resize2fs to resize the ext4 filesystem on that volume:
1. Umount the mount point:
# umount /data
2. Perform the resize operation:
# lvresize --size 2G /dev/vg_name/lv_name
In the example just shown, the volume and the filesystem are both resized to 2GB.
3. Run the fsck:
# e2fsck -f /dev/vg_name/lv_name
4. Next, mount the volume again and check the disk space:
# mount -t ext4 /dev/vg_name/lv_name /data # df -h /data
lvresize command examples
1. To resize a logical volume (in units of logical extents)
# lvresize -l [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] # lvresize --extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}]
2. To do not perform fsck before resizing filesystem when filesystem requires it:
# lvresize -n # lvresize --nofsck
3. To disable udev synchronization:
# lvresize --noudevsync
4. To resize underlying filesystem together with the logical volume using fsadm:
# lvresize -r # lvresize --resizefs
5. To change or set the logical volume size in units of megabytes:
# lvresize -L [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE] # lvresize --size [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
6. To gives the number of stripes to use when extending a Logical Volume:
# lvresize -i stripes # lvresize --stripes stripes
7. To gives the number of kilobytes for the granularity of the stripes
# lvresize -I StripeSize # lvresize --stripesize StripeSize