root盘满了怎么办
# 问题
- /dev/mapper/centos-root 占用100%导致Tab键用不了,而且docker微服务应用的验证码出不来
[root@new1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 24K 63G 1% /dev/shm
tmpfs 63G 1.1G 62G 2% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 50G 20K 100% /
/dev/sda2 1014M 208M 807M 21% /boot
/dev/mapper/centos-home 4.5T 188G 4.4T 5% /home
tmpfs 13G 0 13G 0% /run/user/987
tmpfs 13G 64K 13G 1% /run/user/0
overlay 50G 50G 20K 100% /var/lib/docker/overlay2/bc5fc2456c87054300bc3d0e2e619e17078de019849e1bf19fba1edcd66bc6af/merged
shm 64M 0 64M 0% /var/lib/docker/containers/e66aa9db52490a4ec4f39809c4bbf9212ede0059307e21856160515970c29be5/mounts/shm
overlay 50G 50G 20K 100% /var/lib/docker/overlay2/8f36525342c66b508369735032f3763712ef381da76a046173d718972b51fbdf/merged
overlay 50G 50G 20K 100% /var/lib/docker/overlay2/73c0bdf479c40526cdd1ab9f85ea0355fb7986ea4514e6925a2a954216f28bf0/merged
shm 64M 0 64M 0% /var/lib/docker/containers/cfe748305f892a932337df13af27b0662acc1aa2cfa112bea4b37fe3d3e16027/mounts/shm
overlay 50G 50G 20K 100% /var/lib/docker/overlay2/8a45574efb09a4740a6ea31bf8a31acd0b49e7ab738934261ebaf61623ad98d0/merged
shm 64M 0 64M 0% /var/lib/docker/containers/06c90561da84bc70c4fdb826a0f902ac3df0df19535a42f6f6052ddc92350a54/mounts/shm
shm 64M 0 64M 0% /var/lib/docker/containers/30271ff7afc6c09a368dbf42b1567650013a1b56fba7991322187976296c738e/mounts/shm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 解决方式一(删)
- 查找大文件,对于过高目录中的内容适当删减腾出一些空间
[root@new1 ~]# cd /
[root@new1 /]# du -h -x --max-depth=1
59M ./etc
123M ./root
du: cannot access ‘./var/lib/rsyslog/imjournal.state.tmp’: No such file or directory
40G ./var
82M ./tmp
5.4G ./usr
0 ./media
0 ./mnt
4.3G ./opt
0 ./srv
0 ./Users
50G .
[root@new1 /]# cd opt
[root@new1 opt]# ll
total 203480
drwxrwxr-x 11 smartmining smartmining 229 Jun 30 2018 kibana-6.3.1-linux-x86_64
-rw-r--r-- 1 root root 205397076 Oct 27 14:25 kibana-6.3.1-linux-x86_64.tar.gz
-rw-r--r-- 1 root root 2965388 Sep 11 15:19 mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm
drwxr-xr-x 2 root root 45 Sep 27 17:56 prometheus
drwxr-xr-x. 2 root root 6 Oct 31 2018 rh
drwxr-xr-x 3 root root 28 Aug 24 18:31 tableau
[root@new1 opt]# du -sh *
748M kibana-6.3.1-linux-x86_64
196M kibana-6.3.1-linux-x86_64.tar.gz
2.9M mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm
8.0K prometheus
0 rh
3.4G tableau
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
- 这里删除
[root@new1 opt]# rm -rf kibana-6.3.1-linux-x86_64.tar.gz
[root@new1 opt]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 24K 63G 1% /dev/shm
tmpfs 63G 1.2G 62G 2% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 50G 159M 100% /
/dev/sda2 1014M 208M 807M 21% /boot
/dev/mapper/centos-home 4.5T 188G 4.4T 5% /home
tmpfs 13G 0 13G 0% /run/user/987
tmpfs 13G 64K 13G 1% /run/user/0
overlay 50G 50G 159M 100% /var/lib/docker/overlay2/bc5fc2456c87054300bc3d0e2e619e17078de019849e1bf19fba1edcd66bc6af/merged
shm 64M 0 64M 0% /var/lib/docker/containers/e66aa9db52490a4ec4f39809c4bbf9212ede0059307e21856160515970c29be5/mounts/shm
overlay 50G 50G 159M 100% /var/lib/docker/overlay2/8f36525342c66b508369735032f3763712ef381da76a046173d718972b51fbdf/merged
overlay 50G 50G 159M 100% /var/lib/docker/overlay2/73c0bdf479c40526cdd1ab9f85ea0355fb7986ea4514e6925a2a954216f28bf0/merged
shm 64M 0 64M 0% /var/lib/docker/containers/cfe748305f892a932337df13af27b0662acc1aa2cfa112bea4b37fe3d3e16027/mounts/shm
overlay 50G 50G 159M 100% /var/lib/docker/overlay2/8a45574efb09a4740a6ea31bf8a31acd0b49e7ab738934261ebaf61623ad98d0/merged
shm 64M 0 64M 0% /var/lib/docker/containers/06c90561da84bc70c4fdb826a0f902ac3df0df19535a42f6f6052ddc92350a54/mounts/shm
shm 64M 0 64M 0% /var/lib/docker/containers/30271ff7afc6c09a368dbf42b1567650013a1b56fba7991322187976296c738e/mounts/shm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 解决方式二(扩容)
CentOS 7 调整 home分区扩大 root分区
总体过程:把/home内容备份,然后将/home文件系统所在的逻辑卷删除,扩大/root文件系统,新建/home ,恢复/home内容
- 查看分区
df -h
1
- 备份home分区文件
tar cvf /tmp/home.tar/home
1
- 卸载/home,如果无法卸载,先终止使用/home文件系统的进程
fuser -km /home/
umount /home
1
2
3
2
3
- 删除/home所在的lv
lvremove/dev/mapper/centos-home
1
- 扩展/root所在的lv,增加800G
lvextend -L +800G/dev/mapper/centos-root
1
- 扩展/root文件系统
xfs_growfs/dev/mapper/centos-root
1
- 重新创建home lv
lvcreate -L 73G -n/dev/mapper/centos-home
1
- 创建文件系统
mkfs.xfs /dev/mapper/centos-home
1
- 挂载home
mount/dev/mapper/centos-home
1
- home文件恢复
tar xvf /tmp/home.tar -C/home/
cd /home/home/
mv * ../
1
2
3
4
5
2
3
4
5