20

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?

3
  • 1
    Do you have snapshots enabled?
    – MadHatter
    Feb 14, 2013 at 9:01
  • have you check if is there any process running still using the file ? (check with lsof), if so, please stop the process and try to remove the file again.
    – chocripple
    Feb 14, 2013 at 9:04
  • Not sure if related but I just got a similar problem on macOS Catalina
    – Jonny
    Jul 30, 2020 at 12:51

4 Answers 4

25

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.

3
  • 3
    The trick works nicely also for a cifs mounted network drive, thanks!
    – markusN
    Feb 5, 2017 at 13:41
  • Didn't work on Mac sadly. 😟
    – kiradotee
    May 7, 2020 at 16:47
  • Worked on macos Sierra with no space left. Thanks! Apr 22, 2023 at 15:50
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.

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .