[root@RHEL ~]# df -lh #显示当前各个分区的使用情况
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 992M 181M 760M 20% /
/dev/mapper/vg-usr 2.0G 787M 1.1G 42% /usr
/dev/mapper/vg-var 2.0G 86M 1.8G 5% /var
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/mapper/vg-home 992M 11M 930M 2% /home
[root@RHEL ~]# umount /dev/vg/home #卸载/dev/vg/home
[root@RHEL ~]# e2fsck -f /dev/vg/home #强制检查/dev/vg/home文件系统的正确性
e2fsck 1.39 (29-May-2006)
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/home: 17/262144 files (17.6% non-contiguous), 44125/1048576 blocks
[root@RHEL ~]# resize2fs /dev/vg/home 256M #先缩小/dev/vg/home文件系统的大小
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/vg/home to 262144 (1k) blocks.
The filesystem on /dev/vg/home is now 262144 blocks long.
--------------------------------------------------------------------
resize2fs 程序可以更改ext2/ext3文件系统。它可以放大和缩小它能够找到的设备上的被umount掉的文件系统。如果文件系统是处于mount状态下,那么它只能做到扩容,前提条件是内核支持在线resize(linux kernel2.6支持在mount状态下扩容但仅限于ext3文件系统)。
--------------------------------------------------------------------
[root@RHEL ~]# lvresize -L 256M /dev/vg/home #缩小/dev/vg/home的LVM大小
WARNING: Reducing active logical volume to 256.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce home? [y/n]: y
Reducing logical volume home to 256.00 MB
Logical volume home successfully resized
[root@RHEL ~]# mount -a
[root@RHEL ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 992M 181M 760M 20% /
/dev/mapper/vg-usr 2.0G 787M 1.1G 42% /usr
/dev/mapper/vg-var 2.0G 86M 1.8G 5% /var
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/mapper/vg-home 248M 11M 228M 5% /home
阅读(1606) | 评论(0) | 转发(0) |