简体   繁体   English

如何在Linux系统上查找大文件并删除

[英]how to find big file and delete on linux system

When I install something in my linux system( CentOS release 6.5 (Final) ).It happens. 当我在linux系统中安装某些东西( CentOS版本6.5(Final) )时,它发生了。

Error Downloading Packages: ncdu-1.7-1.el6.x86_64: Insufficient space in download directory /var/cache/yum/epel/packages . 错误下载软件包:ncdu-1.7-1.el6.x86_64:下载目录/ var / cache / yum / epel / packages中空间不足。

And I use df command,it shows: 我使用df命令,它显示:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        77G   73G     0 100% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
/dev/sda1       239M   43M  183M  19% /boot

sda2 was mounted on /,but when I go to the root and use command du . sda2安装在/上,但是当我进入根目录并使用命令du时

du -sh *
6.2M    bin
41M boot
176K    dev
26M etc
488K    export
6.7G    home
268M    lib
19M lib64
16K lost+found
4.0K    media
4.0K    mnt
56M opt
du: cannot access `proc/1531/task/1531/fd/4': No such file or directory
du: cannot access `proc/1531/task/1531/fdinfo/4': No such file or directory
du: cannot access `proc/1531/fd/4': No such file or directory
du: cannot access `proc/1531/fdinfo/4': No such file or directory
du: cannot access `proc/6873/task/7037/fd/125': No such file or directory
0   proc
640K    root
9.0M    sbin
4.0K    selinux
4.0K    srv
0   sys
569M    tmp
1.4G    usr
261M    var
4.0K    zookeeper_server.pid

where is my 77G gone? 我的77G哪里去了? how do I find my big file and delete? 如何找到我的大文件并删除?

If you cannot afford to reboot your server, this command shall help you : 如果您无力重启服务器,此命令将为您提供帮助:

lsof | grep "/var" | grep deleted

It will show you if there is any deleted file still in memory, and help you find which service has to be restarted. 它将显示内存中是否还有已删除的文件,并帮助您找到必须重新启动的服务。

If that is an option, a server reboot can also solve the problem. 如果可以的话,重新启动服务器也可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM