Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Cannot remove a file nor a directory containing it.

output of ls -la:

-????????? ? ?           ?                  ?            ? 1221036243.V905I191359M574755.domain.com:2$


[root@domain Maildir]# chmod -R 777 cur
chmod: cannot access `cur/1221036243.V905I191359M574755.domain.com:2$': No such file or directory


[root@domain Maildir]# rm -rf cur
rm: cannot remove `cur': Directory not empty

rm -rf 1221036243.V905I191359M574755.domain.com:2$
rm -rf 1221036243.V905I191359M574755.domain.com:2\$

NO output at all.


[root@domain cur]# getfacl .
# file: .
# owner: root
# group: root


[root@domain /]# umount backup
[root@domain /]# fsck /dev/md119
fsck from util-linux 2.19.1
e2fsck 1.41.14 (22-Dec-2010)
/dev/md119: clean, 1487811/183148544 files, 80994051/732566603 blocks
[root@domain /]# mount backup


[root@domain /]# fsck -f /dev/md119
fsck from util-linux 2.19.1
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Problem in HTREE directory inode 180886324: block #10437 has bad min hash
Invalid HTREE directory inode 180886324 (/.snapshots/daily.2/h1/mailboxs/magazin/Maildir/cur).  Clear HTree index<y>? yes

Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/md119: ***** FILE SYSTEM WAS MODIFIED *****
/dev/md119: 1487811/183148544 files (0.1% non-contiguous), 80980327/732566603 blocks

And many thanks goes to Michael Hampton with his fsck -f /dev/md119.

share|improve this question
have you tried fix the fs? –  0wn3r May 29 '13 at 18:13
uhm...fsck? not yet. –  Jevgeni Smirnov May 29 '13 at 18:20
Please try to rm the file or directory, and post the output and error here. –  Stefan Lasiewski May 29 '13 at 18:22
You need to run fsck with the -f option, to actually do the check. –  Michael Hampton May 29 '13 at 18:47
Has fsck -f solved the problem? –  Hauke Laging May 29 '13 at 18:58

2 Answers 2

up vote 1 down vote accepted

You need to run fsck with the -f option, to actually do the filesystem check.

share|improve this answer

The problem is that you have read access to the directory but no execute and no write access. Execute access will replace the "?" with useful data, write access will allow you to delete the file.

Write access is not enough to delete a directory entry. Execute permission is required, too.

share|improve this answer
what should i do then? Directory is 777 at all. –  Jevgeni Smirnov May 29 '13 at 18:19
@JevgeniSmirnov Strange. There are other possible reasons why you cannot delete something but for not seeing the metadata...? Are there ACLs active (getfacl .)? SELinux, AppArmor? –  Hauke Laging May 29 '13 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.