Since I found there's no free space in the main volume group for extending other volumes, so I intend to shrink some non-critical volumes to squeeze some more free space.
[root@test ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_test 1 3 0 wz--n- 79.51g 0
Let's see all the volumes and target non-critical volumes.
[root@test ~]# lvdisplay
...
--- Logical volume ---
LV Path
/dev/vg_test/lv_home
LV Name lv_home
VG Name vg_test
LV UUID U9nE09-fTBU-CBx4-hCyd-YHZz-bQHu-LlWtXR
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-07-29 22:47:15 +0800
LV Status available
# open 1
LV Size 25.60 GiB
Current LE 6554
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
...
We should make sure there's 5GB can be squeezed from this volume.
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/vg_test-lv_home
26G 45M 24G 1% /home
As you can see above, the volume has more than 5GB free space that can be squeezed. But before we proceed, I must remind you that the resizing a volume is quite an error-prone process, you must do it carefully.
Let's umount the volume first.
[root@test ~]# umount /dev/vg_test/lv_home
Check the consistency of the file system in the volume.
[root@test ~]# e2fsck -f /dev/vg_test/lv_home
e2fsck 1.43-WIP (20-Jun-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg_test/lv_home: 26/1679360 files (0.0% non-contiguous), 149434/6711296 blocks
OK, it's passed.
Resize the file system of this volume to 20GB.
[root@test ~]# resize2fs /dev/vg_test/lv_home 20G
resize2fs 1.43-WIP (20-Jun-2013)
Resizing the filesystem on /dev/vg_test/lv_home to 5242880 (4k) blocks.
The filesystem on /dev/vg_test/lv_home is now 5242880 blocks long.
Resize the partition of this volume to 20GB.
[root@test ~]# lvreduce -L 20G /dev/vg_test/lv_home
WARNING: Reducing active logical volume to 20.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
Size of logical volume vg_test/lv_home changed from 25.60 GiB (6554 extents) to 20.00 GiB (5120 extents).
Logical volume lv_home successfully resized
Remount the volume.
[root@test ~]# mount /dev/vg_test/lv_home
Let's check the result.
[root@test ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_test 1 3 0 wz--n- 79.51g 5.60g
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/vg_test-lv_home
20G 44M 19G 1% /home
Now, we have 5.6GB free space.