在安装系统时LVM的大小没有设定好,还好可以在线收缩和扩展。
1,看下各逻辑卷大小
[root@bogon ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
39G 461M 37G 2% /
/dev/mapper/VolGroup00-LogVol03
64G 222M 61G 1% /var
/dev/mapper/VolGroup00-LogVol02
49G 2.0G 45G 5% /usr
/dev/mapper/VolGroup00-LogVol01
39G 177M 37G 1% /home
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 1005M 0 1005M 0% /dev/shm
/dev/hdc 3.5G 3.5G 0 100% /media
2,看到home下有lost+found可见home分区单独挂载在一个分区下
[root@bogon ~]# ls /home/
innofidei lost+found
3,卸载并验证
[root@bogon ~]# umount /dev/mapper/VolGroup00-LogVol01
[root@bogon ~]# ls /home/
4,resize2fs 卷组先
[root@bogon ~]# resize2fs /dev/mapper/VolGroup00-LogVol01 20G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/VolGroup00-LogVol01 to 5242880 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol01 is now 5242880 blocks long.
注意这里会提醒你e2fsck的
所以resize2fs之前要这样做: e2fsck -f /dev/mapper/VolGroup-logVol01
5,减小lvm
[root@bogon ~]# lvreduce -L 20G /dev/mapper/VolGroup00-LogVol01
/dev/hdc: open failed: Read-only file system
WARNING: Reducing active logical volume to 20.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
Reducing logical volume LogVol01 to 20.00 GB
Logical volume LogVol01 successfully resized
6,重新挂载并验证
[root@bogon ~]# mount -a
[root@bogon ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
39G 461M 37G 2% /
/dev/mapper/VolGroup00-LogVol03
64G 222M 61G 1% /var
/dev/mapper/VolGroup00-LogVol02
49G 2.0G 45G 5% /usr
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 1005M 0 1005M 0% /dev/shm
/dev/hdc 3.5G 3.5G 0 100% /media
/dev/mapper/VolGroup00-LogVol01
20G 173M 19G 1% /home
[root@bogon ~]# ls /home/
innofidei lost+found
7,扩展另一lvm
[root@bogon ~]# lvextend -L +20G /dev/mapper/VolGroup00-LogVol02
/dev/hdc: open failed: Read-only file system
Extending logical volume LogVol02 to 70.00 GB
Logical volume LogVol02 successfully resized
[root@bogon ~]# resize2fs /dev/mapper/VolGroup00-LogVol02
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol02 is mounted on /usr; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol02 to 18350080 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol02 is now 18350080 blocks long.
8,再验证
[root@bogon ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
39G 461M 37G 2% /
/dev/mapper/VolGroup00-LogVol03
64G 222M 61G 1% /var
/dev/mapper/VolGroup00-LogVol02
68G 2.0G 63G 4% /usr
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 1005M 0 1005M 0% /dev/shm
/dev/hdc 3.5G 3.5G 0 100% /media
/dev/mapper/VolGroup00-LogVol01
20G 173M 19G 1% /home
阅读(3031) | 评论(0) | 转发(0) |