My system is Fedora 19 x86_64 w/3.10.7 kernel. I am trying to use a btrfs snapshot for backing up my /, like this:

btrfs subvolume snapshot / /snap/
tar -cvf - /snap 2>/dev/null | /opt/bup/bin/bup split -n nb -vv
btrfs subvolume delete /snap

Unfortunately the system runs out of free space somewhere at the middle of this process. btrfs filesystem df / reports there is some free space actually:

[root@cellar ~]# btrfs filesystem df /
Data: total=107.21GB, used=75.06GB
System, DUP: total=8.00MB, used=20.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=3.50GB, used=3.00GB
Metadata: total=8.00MB, used=0.00

but I can't neither create nor delete a single file. This is 100% reproducible on every script run. I am usually able to recover from this situation after about 30 mins of random tries to delete anything unimportant. It looks like the root of problem is metadata space shortage. When there is no snapshot my system uses about 2.39-2.40GB of metadata space.

This looks like a bug to me. Why does a snapshot need 0.6GB of the metadata space when there are no heavy writes at this time at all? Why is btrfs unable to use remaining 0.5GB of the metadata space? I tried to use btrfs balance but it did not relocate anything so I guessed the FS was perfectly balanced already. Is it possible to reserve more metadata space somehow? (probably I need to reformat the whole partition but I was unable to find anything related to metadata space size in mkfs.btrfs manual). I guess I can set a larger nodesize using -n option but I'm not sure if it can help.

  • I am trying with btrfs subvolume snapshot -r right now, everything is OK with metadata space so far! – Alex Aug 21 '13 at 23:11
  • I was under the impression that btrfs was still considered experimental and not yet intended for production use. – mdpc Aug 22 '13 at 4:41
  • 1
    Looking for psychological support, Alex? =) – poige Aug 22 '13 at 6:08

Well, BTRFS snapshots are not read-only by default. I tried to use btrfs subvolume snapshot -r to create a read-only snapshot and that helped. No metadata space shortage anymore.

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.