Btrfs – How to Remove an Empty Directory

btrfsfileslinux

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.

Best Answer

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.

Related Question