免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5566 | 回复: 8

Solaris10下无法删除目录 [复制链接]

论坛徽章:
0
发表于 2014-03-04 15:57 |显示全部楼层
环境信息:Solaris 10u10
内核版本:Generic_150400-03
问题现象:
无法用rm命令删除abc目录,ls -al查看发现是空目录,但是硬链接数不对,正常的空目录是2,abc目录显示是3.
请问下有什么办法来纠正硬链接数不对这个问题呢,从而可以正常删除该目录?
# ls -al abc/
total 32
drwxr-x---   3 root     root         117 Mar  4 10:33 .
drwxrwxrwt   5 root     sys          559 Mar  4 11:44 ..
# rm -rf abc/
rm: Unable to remove directory abc/: File exists

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
发表于 2014-03-04 16:42 |显示全部楼层
ls -ald abc

论坛徽章:
0
发表于 2014-03-04 19:57 |显示全部楼层
本帖最后由 San风夕 于 2014-03-04 19:58 编辑

# ls -ald abc
drwxr-x---   3 root     root         117 Mar  4 10:33 abc
回复 2# q1208c


   

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
发表于 2014-03-04 22:02 |显示全部楼层
rmdir?????

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
发表于 2014-03-05 07:49 |显示全部楼层
回复 3# San风夕

这就不知道了. ls显示, 这是一个标准的目录, 也没有 acl 设置.


   

论坛徽章:
0
发表于 2014-03-05 11:26 |显示全部楼层
本帖最后由 San风夕 于 2014-03-05 11:27 编辑

# rmdir abc/
rmdir: directory "abc/": Directory not empty
# ls -al abc/
total 32
drwxr-x---   3 root     root         117 Mar  4 10:33 .
drwxrwxrwt   5 root     sys          559 Mar  5 03:30 ..
# rm -rf abc/
rm: Unable to remove directory abc/: File exists
这个目录下肯定是丢失了目录什么的吧,现在的表现就是:1.硬链接数不对(我标红的那里,本来空目录应该是2的.) 2.无法删除.
回复 4# 东方蜘蛛


   

论坛徽章:
0
发表于 2014-03-06 05:13 |显示全部楼层
Kernel 150400 有嚴重Bugs, 請更新到150400-09再試試.

论坛徽章:
0
发表于 2014-03-18 18:20 |显示全部楼层
给你看看网上查到的
https://blogs.oracle.com/paulie/ ... rectory_file_exists

Cannot remove directory: File exists
By paulie on May 20, 2009
If you try to delete a directory over NFS and get an error such as...

rm: cannot remove directory `asdf/': File exists

... you will notice that conventional methods won't be good enough to remove it.

$ chmod -R 777 asdf/
$ rm -rf asdf/
$ rm: cannot remove directory `asdf/': File exists

Usually there is a file like .nfs234B inside the directory than can be displayed with ls -la

$ ls -la
total 146
drwxr-xr-x 2 user group    512 2009-05-20 08:51 .
drwxr-xr-x 3 user group    512 2009-05-19 08:59 ..
-rwxr-xr-x 1 user group 134888 2009-05-18 12:45 .nfs234B

Removing this file only replaces it with another. There are two solutions: manually delete the file on the NFS server, or (if you don't have that type of access) kill its process.

$fuser -u asdf/.\*
asdf/.:     9070c(user)
asdf/..:    28690c(user)   24845c(user)
asdf/.nfs934B:     9070tm(user)

9070 is the offending process. Kill it with fire.

$ kill -9 9070

Should be able to remove that directory now.

论坛徽章:
0
发表于 2014-03-20 12:50 |显示全部楼层
先谢谢了,
我这里的情况跟你找到的还不一样,最终确认可能的原因是在目录下使用了unlink命令删了一个文件,导致该目录的硬链接数不对,无法删除.
回复 8# calcm


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP