root盘满了怎么办

2022-10-27 13:33:08 浏览数 (1)

# 问题

  • /dev/mapper/centos-root 占用100%导致Tab键用不了,而且docker微服务应用的验证码出不来
代码语言:javascript复制
[root@summer ~]# 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

# 解决方式一(删)

  • 查找大文件,对于过高目录中的内容适当删减腾出一些空间
代码语言:javascript复制
[root@summer ~]# cd /
[root@summer /]# 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@summer /]# cd opt
[root@summer opt]# ll
total 203480
drwxrwxr-x  11 summer summer       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@summer 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
  • 这里删除
代码语言:javascript复制
[root@summer opt]# rm -rf kibana-6.3.1-linux-x86_64.tar.gz
[root@summer 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

# 解决方式二(扩容)

  • 查看空间大小,可以看到这里的root盘满了
代码语言:javascript复制
[root@summer]# df -TH
df: ‘/dev/shm/FlexNetFs.11111’: Transport endpoint is not connected
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs   68G     0   68G   0% /dev
tmpfs                   tmpfs      68G     0   68G   0% /dev/shm
tmpfs                   tmpfs      68G   33M   68G   1% /run
tmpfs                   tmpfs      68G     0   68G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        54G   51G  3.5G  94% /
/dev/sda2               xfs       1.1G  218M  846M  21% /boot
/dev/mapper/centos-home xfs       5.0T  270G  4.7T   6% /home
tmpfs                   tmpfs      14G     0   14G   0% /run/user/987
tmpfs                   tmpfs      14G   66k   14G   1% /run/user/0
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/bc5fc2456c87054300bc3d0e2e619e17078de019849e1bf19fba1edcd66bc6af/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/e66aa9db52490a4ec4f39809c4bbf9212ede0059307e21856160515970c29be5/mounts/shm
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/8f36525342c66b508369735032f3763712ef381da76a046173d718972b51fbdf/merged
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/73c0bdf479c40526cdd1ab9f85ea0355fb7986ea4514e6925a2a954216f28bf0/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/cfe748305f892a932337df13af27b0662acc1aa2cfa112bea4b37fe3d3e16027/mounts/shm
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/8a45574efb09a4740a6ea31bf8a31acd0b49e7ab738934261ebaf61623ad98d0/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/30271ff7afc6c09a368dbf42b1567650013a1b56fba7991322187976296c738e/mounts/shm
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/06c90561da84bc70c4fdb826a0f902ac3df0df19535a42f6f6052ddc92350a54/mounts/shm
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/2df53c4b089d929e0ae0577921d8e1c1c002e44f20871134294c9eb1f3959092/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/487243160c733e66e83c5684a15c0b2a0e7d97bafebec7d093bc2e1c556c5018/mounts/shm
overlay                 overlay    54G   51G  3.5G  94% /var/lib/docker/overlay2/11ff52b453e537cf63ec5e67cefd5877a95d450b02f5ac8e6633d3915df19d7e/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/937b880caf9d435eba57c9b0512900a2f64c8a6ac2ce2d452a85e4c062cbc5aa/mounts/shm
[root@summer]# cd /dev/mapper/
[root@summer mapper]# dmsetup table
centos-home: 0 9640501248 linear 8:3 104859648
centos-swap: 0 8388608 linear 8:3 9745360896
centos-root: 0 104857600 linear 8:3 2048
[root@summer mapper]# echo 0 209715200 linear 8:3 2048| dmsetup load centos-root
[root@summer mapper]# dmsetup resume centos-root
[root@summer mapper]# resize2fs /dev/mapper/centos-root 
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.
[root@summer mapper]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13107200 to 26214400
[root@summer mapper]# df -TH
df: ‘/dev/shm/FlexNetFs.11111’: Transport endpoint is not connected
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs   68G     0   68G   0% /dev
tmpfs                   tmpfs      68G     0   68G   0% /dev/shm
tmpfs                   tmpfs      68G   33M   68G   1% /run
tmpfs                   tmpfs      68G     0   68G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs       108G   51G   58G  47% /
/dev/sda2               xfs       1.1G  218M  846M  21% /boot
/dev/mapper/centos-home xfs       5.0T  270G  4.7T   6% /home
tmpfs                   tmpfs      14G     0   14G   0% /run/user/987
tmpfs                   tmpfs      14G   66k   14G   1% /run/user/0
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/bc5fc2456c87054300bc3d0e2e619e17078de019849e1bf19fba1edcd66bc6af/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/e66aa9db52490a4ec4f39809c4bbf9212ede0059307e21856160515970c29be5/mounts/shm
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/8f36525342c66b508369735032f3763712ef381da76a046173d718972b51fbdf/merged
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/73c0bdf479c40526cdd1ab9f85ea0355fb7986ea4514e6925a2a954216f28bf0/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/cfe748305f892a932337df13af27b0662acc1aa2cfa112bea4b37fe3d3e16027/mounts/shm
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/8a45574efb09a4740a6ea31bf8a31acd0b49e7ab738934261ebaf61623ad98d0/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/30271ff7afc6c09a368dbf42b1567650013a1b56fba7991322187976296c738e/mounts/shm
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/06c90561da84bc70c4fdb826a0f902ac3df0df19535a42f6f6052ddc92350a54/mounts/shm
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/2df53c4b089d929e0ae0577921d8e1c1c002e44f20871134294c9eb1f3959092/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/487243160c733e66e83c5684a15c0b2a0e7d97bafebec7d093bc2e1c556c5018/mounts/shm
overlay                 overlay   108G   51G   58G  47% /var/lib/docker/overlay2/11ff52b453e537cf63ec5e67cefd5877a95d450b02f5ac8e6633d3915df19d7e/merged
shm                     tmpfs      68M     0   68M   0% /var/lib/docker/containers/937b880caf9d435eba57c9b0512900a2f64c8a6ac2ce2d452a85e4c062cbc5aa/mounts/shm
[root@summer mapper]# 

0 人点赞