3

I have a laptop with a Samsung 840 500 GB SSD, and I've installed openSUSE 12.3 with btrfs as the filesystem.

A few days ago I first got a message from my web browser about it not being able to save its bookmark file. Shortly thereafter my computer became unstable and was unable to boot properly again. Booting into a live system and deleting some of the earlier snapshots (taken automatically by snapper) fixed the problem so that I was again able to boot.

Before the crash the filesystem was roughly 70 % full as reported by both df, btrfs filesystem show and btrfs filesystem df /.

I was under the impression that when df and btrfs filesystem df agree that the filesystem has plenty of space left, then everything should be fine. The output of btrfs filesystem show after deleting the snapshots was:

Label: none  uuid: 9eeb0c9b-c419-49f1-8476-ea0f19d262b4
    Total devices 1 FS bytes used 252.33GB
    devid    1 size 449.61GB used 449.61GB path /dev/dm-1

The amount of FS bytes used is lower than before the crash (which is as expected since snapshots are counted into this total from what I understand), while the device bytes used (449.61GB) is still showing as full.

So my question is whether it should be considered problematic when the device bytes used approaches the total size of the device? I am currently running a balance operation just to be safe, but I was under the impression that the device bytes used only really represented how much of the device had been claimed by btrfs thus far, and that the FS bytes used value was the real measure of how much is actually being used right now.

Since a balance operation is quite time consuming, and subjects a TLC NAND based SSD like the Samsung 840 to a significant amount of wear, this is kind of important and it's a fairly big problem of btrfs requires such operations regularly to remain stable.

1

The answer turns out to be "yes". A fair description of the problem is given here

Essentially a full device means btrfs can no longer allocate more "chunks", and may for example be in a position where no more metadata can be allocated.

If the FS bytes used value is low (as it was in my case) then a balance operation can solve the problem. For example:

btrfs filesystem balance start -dusage=20 /

This command will rebalance (and thus hopefully also reclaim some device space) all chunks that are 20 % used or less. The higher the number (0-100 %) the more work will be done.

It seems likely that this will be handled in the background some time in the future, but as of linux 3.14 this still has to be done manually as far as I know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.