- 爱易网页
-
Linux
- Linux上调整根目录的空间大小
日期:2014-05-16 浏览次数:20697 次
Linux下调整根目录的空间大小
一、目的
在使用CentOS6.3版本linux系统的时候,发现根目录(/)的空间不是很充足,而其他目录空间有很大的空闲,所以本文主要是针对现在已有的空间进行调整。首先,先来查看一下系统的空间分配情况:
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# df -h
02.Filesystem Size Used Avail Use% Mounted on
03./dev/mapper/vg_centos-lv_root
04. 50G 14G 34G 30% /
05.tmpfs 1.9G 0 1.9G 0% /dev/shm
06./dev/sda1 485M 37M 423M 8% /boot
07./dev/mapper/vg_centos-lv_home
08. 404G 670M 382G 1% /home
下面的详细步骤部分将从vg_centos-lv_home分区下取出100G的空间添加到/vg_centos-lv_root分区上去。
二、详细步骤
1、卸载vg_centos-lv_home分区
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# umount /home
此时在用df命令查看将会发现/home目录已经看不见了,如下所示:
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# df -h
02.Filesystem Size Used Avail Use% Mounted on
03./dev/mapper/vg_centos-lv_root
04. 50G 14G 34G 30% /
05.tmpfs 1.9G 0 1.9G 0% /dev/shm
06./dev/sda1 485M 37M 423M 8% /boot
2、从新设定vg_home-lv_home的大小
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# resize2fs -p /dev/mapper/vg_centos-lv_home 282G
02.resize2fs 1.41.12 (17-May-2010)
03.Please run 'e2fsck -f /dev/mapper/vg_centos-lv_home' first.
这一步设定vg_home-lv_home大小没有成功,系统提示我们先运行下面的命令,操作如下:
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# e2fsck -f /dev/mapper/vg_centos-lv_home
02.e2fsck 1.41.12 (17-May-2010)
03.Pass 1: Checking inodes, blocks, and sizes
04.Pass 2: Checking directory structure
05.Pass 3: Checking directory connectivity
06.Pass 4: Checking reference counts
07.Pass 5: Checking group summary information
08./dev/mapper/vg_centos-lv_home: 1386/26836992 files (0.9% non-contiguous), 1855856/107344896 blocks
从新设定vg_home-lv_home的大小:
[plain] view plaincopyprint?
01.[root@CentOS-78 /]# resize2fs -p /dev/mapper/vg_centos-lv_home 282G
02.resize2fs 1.41.12 (17-May-2010)
03.Resizing the filesystem on /dev/mapper/vg_centos-lv_home to 73924608 (4k) blocks.
04.Begin pass 2 (max = 43)
05.Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
06.Begin pass 3 (max = 3276)
07.Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
08.Begin pass 4 (max = 266)
09.Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX