Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Empty directory (on ext3) thinks it still has files in it

37 views
Skip to first unread message

Robin Munn

unread,
Mar 28, 2005, 2:35:12 AM3/28/05
to
So I'm going through my mail archive, backing up old files and clearing
it out, and I come across a directory that's empty but which still
thinks it has files in it:

rmunn@localhost ~/.maildir $ ls -l .xml
ls: .xml/cur: No such file or directory
ls: .xml/new: No such file or directory
total 0
rmunn@localhost ~/.maildir $

"That's bizarre", I think to myself. "What happens if we rmdir it?"

rmunn@localhost ~/.maildir $ rmdir .xml
rmdir: `.xml': Directory not empty
rmunn@localhost ~/.maildir $

"OK, let's create the files it thinks are in there, and see what it
does."

rmunn@localhost ~/.maildir $ mkdir .xml/{cur,new}
rmunn@localhost ~/.maildir $ ls -l .xml
total 0
drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 cur
drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 cur
drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
rmunn@localhost ~/.maildir $

"That's a new one. We've got duplicate directories lying around here! I
wonder what inodes they're using?"

rmunn@localhost ~/.maildir $ ls -li .xml
total 0
70292 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 cur
70292 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 cur
70434 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
70434 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
rmunn@localhost ~/.maildir $

"Huh. Look at that. Two entires for the same inode, with the same name.
That shouldn't happen. Hmm... What happens if I delete one?"

rmunn@localhost ~/.maildir $ rmdir .xml/cur
rmunn@localhost ~/.maildir $ ls -li .xml
ls: .xml/cur: No such file or directory
total 0
70434 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
70434 drwxr-xr-x 2 rmunn users 48 Mar 28 01:28 new
rmunn@localhost ~/.maildir $


This has me stumped. Anyone seen anything like this before? How do I
clean this up? There's no files I want to save, I just want to get rid
of my ~/.maildir/.xml directory.

This is on a Linux ext3 filesystem, by the way. Running Gentoo with
kernel 2.6.10.

Any help or pointers in the right direction would be much appreciated.

Wayne

unread,
Mar 28, 2005, 11:17:43 AM3/28/05
to
Robin Munn wrote:
> So I'm going through my mail archive, backing up old files and clearing
> it out, and I come across a directory that's empty but which still
> thinks it has files in it:
>
> rmunn@localhost ~/.maildir $ ls -l .xml
> ls: .xml/cur: No such file or directory
> ls: .xml/new: No such file or directory
> total 0
> rmunn@localhost ~/.maildir $
> ...

>
> Any help or pointers in the right direction would be much appreciated.
>

Looks to me as if you have a pair of files in there, with a space
in the names. Try "ls" without the "-l" option on that directory,
or try "find".

Note you can delete a directory and all of its contents with the
rather dangerous "rm -rf".

-Wayne

Robin Munn

unread,
Mar 28, 2005, 3:21:27 PM3/28/05
to

Nope, it's something slightly more obscure than a simple
space-in-filename problem. I already tried doing an "rm -rf
~/.maildir/.xml" with no success:

rmunn@localhost ~/.maildir $ ls -a .xml/


ls: .xml/cur: No such file or directory
ls: .xml/new: No such file or directory

. ..
rmunn@locahost ~/.maildir $ rm -rf .xml
rm: cannot remove directory `.xml': Directory not empty
rmunn@localhost ~/.maildir $

When "rm -rf" tells you "Cannot remove directory foo: directory not
empty", you know something's screwy...

Thanks for your help, though.

Jack Masters

unread,
Mar 28, 2005, 3:32:57 PM3/28/05
to
fsck ?
0 new messages