昨晚服务器意外出现Directory not empty故障

昨晚在编写一个用于自动抓取一些域名到期信息并进行过滤整理的shell脚本时,不甚操作不当,导致出现服务器上一个目录无法删除,使用rm -rf也无效,目录中原有文件和新创建的文件均无法查看,使用ls -al也无任何显示,有点“黑洞”的感觉,明明里面有东西,却无法显示,新创建文件也看不到,想删除目录还无法删除,以前没有遇到过这样的故障,于是尝试若干办法还是未能收到效果,反倒搞得该目录的上级目录出现混乱,部分其他目录也出现了类似情况,大呼不妙,迫不得已进行远程重启,无奈重启失败,今天一早到了机房,从错误日志上一看,明白了故障所在。

这样的故障一般会出现在ports软件升级突然中断,或者有关磁盘目录创建删除等操作的程序意外中断时,而且也不是总能出现,还得有很多偶然情况发生赶巧了才能遇到。我之前的脚本在调试过程中放入了后台运行,结果意外被我中断并重新运行,结果导致了目录中.的指向错误,进而导致一个后台的fsck失败,这样日志中就看到了类似这样的错误信息
PARTIALLY TRUNCATED INODE I=316169
UNEXPECTED SOFT UPDATE INCONSISTENCY; RUN fsck MANUALLY.

于是有了解决思路,重启后 boot -s进入单用户模式,运行fsck -p ,再次重启,问题解决:)总的来说算是有惊无险!

其实过后查询文档知道如果遇到那样的目录错误,可以使用 chflags -R noschg 进行处理,实在不行再重启 fsck -p

不知道有没有高人对这样的故障有另外的指点?freebsd总是这样让我又爱又恨,听说最近Release 6.1出来了,有时间升级一下。

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
One Response
  1. healthly says:

    不知道这位兄弟,freebsd让你有爱有恨的原因是什么,可否告知小弟一二。

  2. jordan retro says:

    Can I simply say what a reduction to search out someone who truly knows what theyre talking about on the internet. You definitely know how you can carry a problem to light and make it important. More individuals must learn this and perceive this side of the story. I cant imagine youre not more standard since you definitely have the gift.

  3. Pingback: yeezy boost 500
  4. Pingback: nike shoes
  5. Pingback: nba jerseys

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image