解决RM删除没有释放空间问题

Posted vkbwxdx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决RM删除没有释放空间问题相关的知识,希望对你有一定的参考价值。

www@172-18-8-12 log]$ df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 120G 101G 20G 84% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 601M 7.2G 8% /run

我删除文件时,直接用的rm 没有加参数lf,结果空间没有释放

文件已经找不到了,查阅资料,按如下办法解决了问题

(1)安装工具 yum install lsof

root@pts/5 # yum install lsof
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors-internal.yyhu.com
* extras: mirrors-internal.yyhu.com
* updates: mirrors-internal.yyhu.com
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2604:a880:1:20::b82:1001: Network is unreachable"
Trying other mirror.
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 951 B 00:00:00
(1/7): epel/x86_64/group_gz | 88 kB 00:00:00
(2/7): base/7/x86_64/group_gz | 166 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 996 kB 00:00:00
(4/7): extras/7/x86_64/primary_db | 205 kB 00:00:00
(5/7): base/7/x86_64/primary_db | 6.0 MB 00:00:00
(6/7): updates/7/x86_64/primary_db | 7.4 MB 00:00:00
(7/7): epel/x86_64/primary_db | 6.8 MB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package lsof.x86_64 0:4.87-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================
Installing:
lsof x86_64 4.87-6.el7 base 331 k

Transaction Summary
============================================================================================================================================
Install 1 Package

Total download size: 331 k
Installed size: 927 k
Is this ok [y/d/N]: y
Downloading packages:
lsof-4.87-6.el7.x86_64.rpm | 331 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : lsof-4.87-6.el7.x86_64 1/1
Verifying : lsof-4.87-6.el7.x86_64 1/1

Installed:
lsof.x86_64 0:4.87-6.el7

Complete!

(2) 查看待kill 的相关进程(未释放空间的,第二列是)

root@pts/5 # lsof -n / |grep deleted
dbus-daem 551 dbus 5r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
polkitd 556 polkitd 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 923 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 923 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 923 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 924 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 924 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 924 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 925 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 925 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 925 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 926 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 926 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 926 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 927 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 927 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 927 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
zabbix_ag 928 zabbix 1w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 928 zabbix 2w REG 253,1 14809 167772882 /var/log/zabbix/zabbix_agentd.log-20181114 (deleted)
zabbix_ag 928 zabbix 3r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
sssd 1466 root 16r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
sssd_be 1467 root 23r REG 253,1 10406312 100664504 /var/lib/sss/mc/initgroups (deleted)
java 16800 www 1w REG 253,1 58851191267 134218392 /www/data-service/log/sys.log (deleted)
java 17417 root 1w REG 253,1 27109202795 388015 /tmp/admin.log (deleted)
java 17417 root 2w REG 253,1 27109202795 388015 /tmp/admin.log (deleted)

(3)KILL 释放空间

root@pts/5 # kill -9 16800
172-18-8-173.youyuan-idc.com [/home/shaohualong] 2019-08-07 10:09:00
root@pts/5 # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 120G 46G 75G 38% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 601M 7.2G 8% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
192.168.0.71:/vol/vol2 2.0T 1.5T 551G 73% /share
tmpfs 1.6G 0 1.6G 0% /run/user/0
tmpfs 1.6G 0 1.6G 0% /run/user/1285400147
tmpfs 1.6G 0 1.6G 0% /run/user/1285400064
tmpfs 1.6G 0 1.6G 0% /run/user/3527

以上是关于解决RM删除没有释放空间问题的主要内容,如果未能解决你的问题,请参考以下文章

rm删除文件空间不释放

rm删除文件空间不释放

Linux删除文件之后磁盘空间没有被释放

rm删除文件,空间没有释放

LINUX删除文件,但空间不释放

通过RMAN删除归档日志不释放问题