makadeade
home about archive

btrfs

Published: August 31st 2025 (week 35 of 2025)

I recently changed the way I use my disks, and this involved doing things with btrfs. This post is a short collection of useful links and information I found, and is kind-of a bookmark for me. A better article, with much more information can be found here.

No space left on device

One of the worst things you can see on a btrfs filesystem. To fix the problem, you can follow the advice in SUSE's Knowledge Base. The summary:


]# btrfs device add /dev/<some-space> /<existing-fs>
]# btrfs balance start /<existing-fs>
    

First, you add a new device to the filesystem to provide btrfs with some extra space to work with. Then, you rebalance the filesystem to let btrfs tidy up a bit. If the lack of space was just an "accounting" problem, these two actions should fix it; but if you really have no space left then you just have to go buy a new disk, or delete some files.

After the problem is fixed, you should be able to safely remove the scratch space:


]# btrfs device remove /dev/<some-space> /<fs-with-no-space>
    

RAID, profiles, and multi-device filesystems

I consider btrfs to be a wonderful invention, and use it on all my systems. Here one can find a good in-depth article about data profiles and filesystems spanning multiple devices. One crucial piece of information is how one converts between the single, DUP, and eg, raid1 profiles.

By default, btrfs allocates Data chunks using the single profile (ie, only one copy of the data is kept), while using the DUP profile for Metadata chunks (ie, two copies of metadata are kept). While this is nice, the metadata are duplicated on a single disk, which is a bit too risky for my taste.

That is why I keep my filesystems' data and metadata on multiple disks using the raid1 profile. How does one go from the default state to RAID1?


]# btrfs device add /dev/<new-device> /<existing-fs>
]# btrfs balance start -mconvert=raid1 -dconvert=raid1 /<existing-fs>
    

The -mconvert= flag tells btrfs which profile to use for Metadata chunks; and the -dconvert= flag specifies the profile to be used for the Data chunks.

Tags

Next: The Tragedy of systemd

Previous: Karaluchy Spalone Słońcem - A.J.K.S.