因为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. Java中CountDownLatch类的使用

    0.CountDownLatch作用 1) Java api中的解释:一个同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待. 2) CountDownLatch可以使J ...

  2. 洛谷【P2003】平板

    我对状态空间的理解:https://www.cnblogs.com/AKMer/p/9622590.html 题目传送门:https://www.luogu.org/problemnew/show/P ...

  3. numpy.zeros(shape, dtype=float, order='C')

    numpy.zeros Return a new array of given shape and type, filled with zeros. Parameters: shape : int o ...

  4. 针对nginx的内核优化

    关于内核参数的优化: net.ipv4.tcp_max_tw_buckets = 6000timewait的数量,默认是180000.net.ipv4.ip_local_port_range = 10 ...

  5. VMware虚拟机重置密码

    1.给vmware虚拟机添加启动延时          1.1 编辑VMware的配置文件.vmx,开机就自动进入BIOS       加入一行:bios.forceSetupOnce = " ...

  6. ls- 查看文件信息

    通过ls 命令不仅可以查看linux文件夹包含的文件,而且可以查看文件权限(包括目录.文件夹.文件权限),查看目录信息等等,ls 命令在日常的linux操作中用的很多,在此给大家介绍一下ls 命令的使 ...

  7. mongodb 查询数据

    MongoDB概念解析: 等同于SQL的数据库表:collectiondocument:等同于SQL的数据记录行field:等同于SQL的数据字段表连接,MongoDB不支持主键,MongoDB自动将 ...

  8. 15、使用ggtree实现进化树的可视化和注释(转载)

    本文作者:余光创,目前就读于香港大学公共卫生系,开发过多个R/Bioconductor包,包括ChIPseeker, clusterProfiler, DOSE,ggtree,GOSemSim和Rea ...

  9. java单链表反转

    今天做leetcode,遇到了单链表反转.研究了半天还搞的不是太懂,先做个笔记吧 参考:http://blog.csdn.net/guyuealian/article/details/51119499 ...

  10. Java对象在内存中的状态

    可达的/可触及的 Java对象呗创建后,如果被一个或者多个变量引用,那就是可达的,即从根节点可以触及到这个对象. 其实就是从根节点扫描,只要这个对象在引用链中,那就是可触及的. 可恢复的 Java对象 ...