Here we show you how to shrink an LVM volume or partition in Linux by first resizing the file system followed by resizing the logical volume.
See here if you’re instead trying to do the opposite and expand an LVM volume.
Note: In this example we are working in CentOS 7, some commands may differ in different Linux distributions. As of CentOS 7 the default file system is XFS which is not currently possible to shrink, this example is working with the ext4 file system.
In this example we will work through shrinking logical volume /var/centos/var from 10GB to 5GB.
Overview of Logical Volume Manager (LVM)
Before working through the resizing process it’s important you first understand some basic concepts around physical volumes, volume groups, logical volumes, and the file system.
- Physical Volume (PV): This can be created on a whole physical disk (think /dev/sda) or a Linux partition.
- Volume Group (VG): This is made up of at least one or more physical volumes.
- Logical Volume (LV): This is sometimes referred to as the partition, it sits within a volume group and has a file system written to it.
- File System: A file system such as ext4 will be on the logical volume.