Linux – “rm: can not remove xxx: No Space left on device” on BTRFS

btrfslinuxpartition

Running OpenSuse 12.2.

Suddenly the root parition seems to be full (99%) but I can no longer remove files manually.

"rm: can not remove xxx: No Space left on device" although 450mb are still free according to df. The filesystem is BTRFS.

I tried checking the FS using btrfsck but it did not help.

What to do?

Best Answer

Most likely, you're running into a problem where BTRFS has to allocate a bit of metadata before it can remove the file. One of BTRFS's weak spots is its handling of the out-of-space condition; improving behavior in this area is one of the project's priorities.

One suggestion on the btrfs wiki is to clobber the file instead of removing it.

#instead of this
rm -f ./some_file

# do this
true >| ./some_file

That'll remove the file's contents without changing the directory entry. Once you've worked your way out of the corner you're in, you can then delete files like normal. If that gives you trouble, you may want to temporarily remount with the nodatacow option, which turns off the copy-on-write behavior. But... not sure for certain if that will help or not.

In general, though: don't run a BTRFS filesystem dry. It's still pre-production software, and the corner cases are a little rough.