1 、查看系统挂载

# df -h
Filesystem                                     Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root        7.9G  938M  6.6G  13%  /
tmpfs                                           497M     0  497M   0%    /dev/shm
/dev/sda1                                     485M   30M  430M   7% /boot
/dev/mapper/VolGroup-LogVol02    4.0G  136M  3.7G   4%   /home
/dev/mapper/VolGroup-LogVol03    3.6G   72M  3.3G   3%    /opt

 
2 、缩小 /home 分区,划分 1G 到根分区
a

# e2fsck -f /dev/VolGroup/LogVol02

e2fsck 1.41.12 (17-May-2010)
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/VolGroup/LogVol02: 11/262144 files (0.0% non-contiguous), 51278/1048576 blocks

 
b

# resize2fs /dev/VolGroup/LogVol02 3092M
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/VolGroup/LogVol02 to 791552 (4k) blocks.
The filesystem on /dev/VolGroup/LogVol02 is now 791552 blocks long.

 
c

# lvresize -L 3092M /dev/VolGroup/LogVol02
  WARNING: Reducing active logical volume to 3.02 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol02? [y/n]: y

  Reducing logical volume LogVol02 to 3.02 GiB
  Logical volume LogVol02 successfully resized

 
3 、再次查看系统状态
a

# df -h
Filesystem                                       Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root          7.9G  938M  6.6G  13% /
tmpfs                                              497M     0  497M   0% /dev/shm
/dev/sda1                                        485M   30M  430M   7% /boot
/dev/mapper/VolGroup-LogVol02       3.0G  134M  2.7G   5% /home
/dev/mapper/VolGroup-LogVol03       3.6G   72M  3.3G   3% /opt

 
b

# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               19.51 GiB
  PE Size               4.00 MiB
  Total PE              4994
  Alloc PE / Size       4743 / 18.53 GiB
  
Free  PE / Size       251 / 1004.00 MiB
  VG UUID               EV2q3Q-ugwW-GpnF-xcnU-CVz0-To2q-urZt9G

 

注:其中的 && Free  PE / Size       251 / 1004.00 MiB  && 表示卷组中可分配空间

 
c 、把可用空间添加到根分区

# lvextend -l +251 /dev/VolGroup/lv_root
  Extending logical volume lv_root to 8.98 GiB
  Logical volume lv_root successfully resized

 

3、重启,系统光盘启动到救援模式;不要配置网络,不要让系统根挂载到/mnt/sysp_w_picpath上,所以最后的界面选择“skip”

 

lvm扩容根分区_第1张图片

 

 

lvm扩容根分区_第2张图片

 
 
4 、开始调整根分区文件系统
 
a 、激活 vg

 

lvm扩容根分区_第3张图片

 
b 、查看激活状态

 

lvm扩容根分区_第4张图片

 
c 、调整文件系统大小

 

lvm扩容根分区_第5张图片

 
d 、确认修改
 

# df -h
Filesystem                                           Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root              8.9G  938M  7.5G  11% /
tmpfs                                                  497M     0  497M   0% /dev/shm
/dev/sda1                                            485M   30M  430M   7% /boot
/dev/mapper/VolGroup-LogVol02           3.0G  134M  2.7G   5% /home
/dev/mapper/VolGroup-LogVol03           3.6G   72M  3.3G   3% /opt

 

# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               19.51 GiB
  PE Size               4.00 MiB
  Total PE              4994
  Alloc PE / Size       4994 / 19.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               EV2q3Q-ugwW-GpnF-xcnU-CVz0-To2q-urZt9G