Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using the experimental btrfs filesystem.

My directory looks like this:

 ls -la empytfolder
 total 4
 drwxr-xr-x 1 root root   0 19. Mär 14:00 .
 drwxr-xr-x 1 root root 298 19. Mär 13:59 ..

I try to removed it with rm -rf emptyfolder but it gives the error rm: cannot remove directory: directory not empty? How can I remove/delete my emptyfolder? Why do I have 4 files in this folder? I'm trying to delete it as a root user. My filesystem is btrfs.

stat emptyfolder gives me:

 Datei: „emptyfolder“
 Größe: 0           Blöcke: 0          EA Block: 4096   Verzeichnis
 Gerät: 21h/33d Inode: 256         Verknüpfungen: 1
 Zugriff: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
 Zugriff    : 2012-03-19 14:00:28.205205566 +0100
 Modifiziert: 2012-03-19 14:00:23.925025572 +0100
 Geändert   : 2012-03-19 14:00:23.925025572 +0100
 Geburt    : -

I've some problems with my system clock. Sometimes it's showing the wrong time.

$ lsof +D emptyfolder
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/user
/.gvfs Output information may be incomplete.

What is this gvfs-fuse-daemon? How can I delete it?

I've tried fuser -uv /dev/disk to no avail. There isn't any process accessing the folder. I've moved the folder to tmp.

share|improve this question
1  
What is the output of shopt -s dotglob nullglob; x=(*) ; echo "${#x[@]}"? Also, "insgesamt" (total) is not the total number of files, but the total number of blocks, including indirect blocks. –  Chris Down Mar 19 '12 at 14:35
    
A few questions: are you deleting them as root? Is the folder in use? Also, as far as my command of German goes, insgesamt 4 means that there are 4 blocks in the folder, not zero. –  Wojtek Rzepala Mar 19 '12 at 14:38
    
shopt -s dotglob nullglob; x=(*) ; echo "${#x[@]}" gives 0 in that folder? –  Phpdna Mar 19 '12 at 14:38
1  
@WojtekRzepala - "insgesamt" is "total", ie "total blocks", not total files. –  Chris Down Mar 19 '12 at 14:39
    
@David - Then there really is nothing in the folder except for the standard . and .. hardlinks. What is the output of echo "$EUID"? –  Chris Down Mar 19 '12 at 14:39
show 5 more comments

2 Answers

up vote 1 down vote accepted

Try cd'ing out of the emptydir and running lsof +D /path/to/emptydir on it to see what has it open. Depending what the directory is and how its used, perhaps something is opening and closing the directory very fast and you just happen to catch it when it doesn't have anything in it when running ls but does have something when running rm -fr emptydir. It shouldn't make any difference in this case, but try also running rmdir emptydir.

The total number at the top of your ls output (I guess insgesamt meants total?) does indicate an empty directory.

I think knowing the filesystem type may be helpful too. You probably also want to run fsck on it and see if that helps.

share|improve this answer
    
My filesystem is btrfs. –  Phpdna Mar 19 '12 at 14:51
    
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/user /.gvfs Output information may be incomplet –  Phpdna Mar 19 '12 at 14:54
    
@deltraray: lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/user /.gvfs Output information may be incomplete. I've moved the folder to tmp. But the problem isn't solved. –  Phpdna Mar 19 '12 at 15:50
add comment

I've had similar symptoms with a btrfs partition and

btrfs check --repair /dev/sdXY

fixed the problem for me. The found errors were of the form:

root X inode Y errors 200, dir isize wrong

and

root X inode Y errors 80, file extent overlap

The second kind of error stayed even after the repair though, which has started worrying me.

share|improve this answer
add comment

Your Answer

 
discard

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.