因为filehome 上小文件过多,所以du –sh * 过滤掉 filehome

du -sh /* --exclude="filehome"

1.1G    /backup

7.8M    /bin

6.8M    /boot

#!/bin/bash
function ergodic(){
for file in `ls $`
do
if [ -d $"/"$file ]
then
ergodic $"/"$file
else
local path=$"/"$file
local name=$file
local size=`du --max-depth= $path|awk '{print $1}'`
echo $name $size $path
echo $size $name $path >> /tmp/file.txt
fi
done
} IFS=$'\n' #done
INIT_PATH=".";
ergodic $INIT_PATH sort -n /tmp/file.txt ####### 文件系统满的话,该如何处理。 .使用以上shell(file.sh)处理
.检查文件总大小是否小于df -k 的占用量,也就说明 进程没来得及释放日志文件,导致日志文件虽然被删除,但是进程仍然hold 空间
  详细请见:(http://www.cnblogs.com/feiyun8616/p/6132670.html)
看到/tmp oracle:dba 目录/tmp/rda 消耗较高,总和小于df -k显示的占用量,看到有oracle 进程占用/tmp.怀疑是清理了空间后进程未释放空间,需要进一步确认
 
方法如下:  

step1: From time to time the du command doesn’t match up with df. This is due to deleted but ‘still open’ file usage

lsof | awk '/deleted/ {sum+=$7} END {print sum}'

step 2:  (check $2 is pid, manaul to kill the process)

lsof | grep deleted

(COMMAND     PID      USER   FD      TYPE             DEVICE   SIZE/OFF       NODE NAME)


for ksh

#for ksh
#!/bin/bash
function ergodic {
for file in `ls $`
do
if [ -d $"/"$file ]
then
# echo $file
ergodic $"/"$file
else
# echo $
# echo $file
local path=$"/"$file
local name=$file
local size=`du -sk $path|awk '{print $1}'`
# echo $name $size $path
echo $size $name $path >> /tmp/file.txt
fi
done
} #IFS=$'\n' #done
INIT_PATH="/11_restore";
#echo $INIT_PATH
ergodic $INIT_PATH sort -n /tmp/file.txt

3.监控脚本本身异常 导致系统 误报。

大量未删除的文件 导致 脚本无法连接数据库,写入日志,出现如下提示。

[root@yidbmon1 ~]# /usr/sbin/lsof |grep home

bash       6623    oracle  cwd       DIR              253,8      12288     131223 /home/oracle/utility/macro

tnslsnr    6940    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

bash       9990    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

bash       9990    oracle  254r      REG              253,8       3493     143496 /home/oracle/11/osw_sort_11pr.sh

bash       9992    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

tee        9993    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

sh        11637    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

sh        11637    oracle    1w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

sh        11637    oracle    2w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

sh        11637    oracle  255r      REG              253,8       3493     143496 /home/oracle/11/osw_sort_11pr.sh

sh        11639    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

sh        11639    oracle    2w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

tee       11640    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

tee       11640    oracle    1w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

tee       11640    oracle    2w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

bash      20767    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

bash      20767    oracle  254r      REG              253,8       2648     143598 /home/oracle/11/osw_sort_edrprod.sh

bash      20769    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

tee       20770    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

bash      21678    oracle  cwd       DIR              253,8       4096          2 /home

se.sh     23010    oracle  cwd       DIR              253,8       4096     142968 /home/oracle/monitor/ngtools/se

se.sh     23010    oracle   11r      REG              253,8       2635     139902 /home/oracle/monitor/ngtools/se/se.sh

se.sh     23010    oracle   12r      DIR              253,8       4096     142968 /home/oracle/monitor/ngtools/se

sh        26763    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26839    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26855    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26871    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26887    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26903    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26919    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26935    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26951    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26967    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        26983    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29049    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29065    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29081    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29097    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29113    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29129    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29145    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29161    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29177    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29193    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sh        29209    oracle  cwd       DIR              253,8       4096     131073 /home/oracle

sleep     29934    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

sleep     29934    oracle    2w      REG              253,8 1994113024     147308 /home/oracle/11/nohup.out (deleted)

sleep     29957    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

sleep     29988    oracle  cwd       DIR              253,8       4096     131099 /home/oracle/11

文件系统满的话(filesystem full),该如何处理。(du and ls)的更多相关文章

  1. 文件系统满的话(filesystem full),该如何处理。

    #!/bin/bash function ergodic(){ ` do "/"$file ] then ergodic $"/"$file else loca ...

  2. db2 load报文件系统满

    使用db2 load导入数据 数据量比较大时常常会报文件系统已满错误. 原因分析:导入表建有索引,在load的“索引复制”阶段会从系统临时表空间拷贝到目标表空间,导致系统临时表空间所在的文件系统满,l ...

  3. 转 由一次磁盘告警引发的血案:du 和 ls 的区别

    如果你完全不明白或者完全明白图片含义, 那么你不用继续往下看了. 否则, 这篇文章也许正是你需要的. 背景 确切地说,不是收到的自动告警短信或者邮件告诉我某机器上的磁盘满了,而是某同学人肉发现该机器写 ...

  4. linux du与ls查看文件大小时的区别

    du和ls查看文件大小的区别 du == disk usage (磁盘使用量,占用的磁盘空间)du 的基本使用du -s     #s参数是可以统计占硬盘空间大小的如 du -skh web-k或-- ...

  5. Linux的磁盘系统和文件系统显示的文件大小为什么不一样(du指令和ls指令的区别)

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  6. Hadoop HDFS文件系统通过java FileSystem 实现上传下载等

    package linlintest; import java.io.File; import java.io.FileOutputStream; import java.io.IOException ...

  7. Linux:文件系统层次结构标准(Filesystem Hierarchy Standard)

    Linux FHS_2.3标准文档:http://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf

  8. Linux下查看文件或文件夹大小的命令df 、du、ls

    转自:http://www.cnblogs.com/benio/archive/2010/10/13/1849946.html 当磁盘大小超过标准时会有报警提示,这时如果掌握df和du命令是非常明智的 ...

  9. du和ls的区别:如何正确计算文件大小

    上一篇文章写到的权限检查脚本,后来我又加入了 apk size 对比的功能,分享给组内同事使用后,暴露出一个问题:脚本输出的 apk size 和 Jenkins 出包信息以及电脑上显示的存储大小都有 ...

随机推荐

  1. BZOJ3680:吊打XXX

    我对模拟退火的理解:https://www.cnblogs.com/AKMer/p/9580982.html 我对爬山的理解:https://www.cnblogs.com/AKMer/p/95552 ...

  2. from selenium.webdriver.support.ui import Select

    from selenium.webdriver.support.ui import Select Select(d.find_element_by_id(u'key_开户行')).first_sele ...

  3. Python:extend和append的用法

    转于:https://www.cnblogs.com/subic/p/6553187.html 博主:subic 1)list.append(object) 向列表中添加一个对象object2)lis ...

  4. Python 二维列表

    一维列表,可以使用 * 快速创建list1=[0]*Width r = [0]*5 print r r[1]= 1 print r [0, 0, 0, 0, 0] [0, 1, 0, 0, 0] 扩展 ...

  5. 使用TRY CATCH进行SQL Server异常处理

    TRY...CATCH是Sql Server 2005/2008令人印象深刻的新特性.提高了开发人员异常处理能力.没有理由不尝试一下Try.. Catch功能. *      TRY 块 - 包含可能 ...

  6. 【java并发编程艺术学习】(一)初衷、感想与笔记目录

    不忘初心,方得始终. 学习java编程这么长时间,自认为在项目功能需求开发中没啥问题,但是之前的几次面试和跟一些勤奋的或者小牛.大牛级别的人的接触中,才发现自己的无知与浅薄. 学习总得有个方向吧,现阶 ...

  7. Intent的简单概述

    Intent是负责在系统组件之间传递信息的一个对象,就像名字一样,是一个意图,可以将当前组件的意图传递给系统,例如启动Activity等,还可以在传递的时候附加上一些值,可以用Bundle对象封装这些 ...

  8. Angular14 Angular相关命令

    1 创建相关 1.1 创建项目 ng new 项目名  ->  创建新项目 ng new 项目名 --skip-install  -> 不进行模块安装  ng new 项目名 -si ng ...

  9. Umbraco中的RelatedLink的使用

    Umbraco中经常需要使用到RelatedLink, 那么在代码中我们如何来获取RelatedLink呢, 可能在Backoffice中我们有一个RelatedLink, 上面有3个链接,如下所示: ...

  10. 22.ThinkPHP5框架缺陷导致远程命令执行

    前言: 昨天爆出了ThinkPHP5框架缺陷导致远程命令执行,大佬们都赶上潮流挖洞,小白还是默默学习一下这个漏洞 漏洞影响范围: Thinkphp 5.1.0 - 5.1.31 Thinkphp 5. ...