[root@LinuxCentOS ~]# vgdisplay --- Volume group --- VG Name vg_linuxcentos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 199.51 GiB PE Size 4.00 MiB Total PE 51074 Alloc PE / Size 51074 / 199.51 GiB Free PE / Size 0 / 0 VG UUID DqgWat-YkkU-V56r-xNFv-XmmX-mgwD-Fi0RWh
[root@LinuxCentOS ~]# lvreduce /dev/mapper/vg_linuxcentos-lv_home -L 20G WARNING: Reducing active and open logical volume to 20.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce vg_linuxcentos/lv_home? [y/n]: y Size of logical volume vg_linuxcentos/lv_home changed from 141.71 GiB (36278 extents) to 20.00 GiB (5120 extents). Logical volume lv_home successfully resized. [root@LinuxCentOS ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_linuxcentos-lv_root 50G 3.4G 44G 8% / tmpfs 3.9G 76K 3.9G 1% /dev/shm /dev/xvda1 477M 36M 417M 8% /boot /dev/mapper/vg_linuxcentos-lv_home 20G 44M 19G 1% /home [root@LinuxCentOS ~]# vgdisplay --- Volume group --- VG Name vg_linuxcentos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 199.51 GiB PE Size 4.00 MiB Total PE 51074 Alloc PE / Size 19916 / 77.80 GiB Free PE / Size 31158 / 121.71 GiB VG UUID DqgWat-YkkU-V56r-xNFv-XmmX-mgwD-Fi0RWh
增加释放的空间到root
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[root@LinuxCentOS ~]# lvextend -L +120G /dev/mapper/vg_linuxcentos-lv_root Size of logical volume vg_linuxcentos/lv_root changed from 50.00 GiB (12800 extents) to 170.00 GiB (43520 extents). Logical volume lv_root successfully resized. [root@LinuxCentOS ~]# resize2fs -p /dev/mapper/vg_linuxcentos-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_linuxcentos-lv_root is mounted on /; on-line resizing required old desc_blocks = 4, new_desc_blocks = 11 Performing an on-line resize of /dev/mapper/vg_linuxcentos-lv_root to 44564480 (4k) blocks. The filesystem on /dev/mapper/vg_linuxcentos-lv_root is now 44564480 blocks long.