19

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?

Andreas Jung
  • 1
  • 1
  • 1
  • 3

4 Answers4

24

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.

tylerl
  • 14,885
  • 7
  • 49
  • 71
2

I have faced the same error message, but in my case the file system was not reported as full:

user@host:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       2.8G  2.0G  618M  77% /

But asking BTRFS revealed that it was indeed full:

user@host:/# btrfs fi show
Label: none  uuid: {UUID redacted because reasons}
        Total devices 1 FS bytes used 1.92GiB
        devid    1 size 2.79GiB used 2.79GiB path /dev/sda3

Even overwriting any files (like tylerl has suggested) was impossible. My solution was found at http://marc.merlins.org/perso/btrfs/post_2014-05-04_Fixing-Btrfs-Filesystem-Full-Problems.html which advises to run a manual rebalancing of the file system using btrfs balance start -dusage=55 /path/to/filesystem.

zovits
  • 131
  • 5
0

For me, using ZFS, I found that deleting other files freed up enough space on the ZFS partition, and then I was able to delete the files in question.

user1429980
  • 101
  • 1
0

In my case, with a ZFS filesystem on Linux, I couldn't even truncate the file. Destroying old snapshots did the trick (if present).

zfs destroy /path/of/snapshot

John White
  • 236
  • 1
  • 3
  • 10