3

My BTRFs root filled up during system update and has been automatically remounted as read-only. I have plenty of files I can erase, but it's read only. I tried:

  1. sudo mount -o remount,rw / → mount point not mounted or bad option

  2. create a /dev/loop0 with a temporary 10G file and try to add it to the BTRFS device: sudo btrfs device add /dev/loop0 /error adding device /dev/loop0: Read-only file system

  3. Rebalance: sudo btrfs balance start -dusage=0 / (also tried -musage=0) → error during balancing '/': Read-only file system

So basically everything I tried fails because the filesystem is read only. I can't remount it as rw for some reason. I'm afraid to reboot the system as it will probably not boot. Is there no hope for someone with a btrfs full root fs?

4
  • Can you mount it elsewhere? My / is mounted from /@ btrfs subvolume, but the whole btrfs root (/) is mounted as /mnt/ssd, so /mnt/ssd/@ duplicates (parts of) my / in some sense (please see this if it's not clear enough). I'm not sure if one of them going read-only would cause the other become read-only as well. The point is it's possible to mount the same filesystem twice. Have you tried? Mar 29 '19 at 15:01
  • Yes, I did try, to an empty directory /mnt2 (/mnt was used), it's not possible: sudo mount /dev/sda5 /mnt2 mount: /mnt2: wrong fs type, bad option, bad superblock on /dev/sda5, missing codepage or helper program, or other error. Edit: I'm not using btrfs subvolumes, that's why I'm mounting /dev/sda5 - it's the only btrfs volume in my system. Mar 29 '19 at 15:06
  • 1
    For now I think my only option is to mount a usb drive, copy the files and reformat everything. I know one thing - I'll stick to ext4 this time :) Mar 29 '19 at 15:07
  • I crashed my btrfs too when running out of space. Manjaro forced a multi-Giga update down my SATA cable. I had snaps tho and happily recovered from the crash. otherwise I'd gone back to ext4 too, but now I'm big btrfs fanboi.
    – dotbit
    Oct 14 '19 at 13:13
0

Had the same problem, manage to fix this by doing this:

umount /home
mount /dev/sdd1 on /home -o rw,clear_cache,skip_balance

This will skip any rebalance operation (my locking point) and clear some cache to free already some space.

But after this, any operation would result still switching to read-only, so i instead did check and stop any rebalance just after the mount command:

btrfs fi balance show /home
btrfs fi balance cancel /home

After this the btrfs was more stable and i was able to resize it

btrfs fi resize max /home

probably the FAQ balance command should also work now or manually remove some big files

The faq reports this (and you may want to try different values from lower to higher, as this is a % of used space in chunks that will be selected by the balance and end up being merged, freeing space)

btrfs fi balance  start -dusage=10 /home

Finally, there is also the path of adding a new device and requesting a rebalance (so a raid0, but you can finetune this later and switch to raid1 if you want and have enough space). btrfs can build "raid" on the fly with several devices (worse case, a temporary usb storage, but remember to remove data and remove the device in the end)

btrfs device add /dev/sdf1 /home
btrfs balance start -dusage=20 -musage=20 /home

Finetune the values in dusage (data) and musage (metadata) to either speedup and/or move more info around. In same cases, you may want to add a --ddevid=??? to limit the rebalance to the full device, so forcing btrfs to move out chunks from the full device to the device with more space. Get the devid from brtfs fi show

See the results in the end (remember that df in btrfs isn't enough as btrfs have several layers and df can only see one)

btrfs fi show
btrfs fi usage /home
btrfs device usage /home
btrfs fi df /home

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.