[arch-general] Btrfs blues - lack of space

Savyasachee Jha savya.jha91 at gmail.com
Sun Aug 31 10:09:34 EDT 2014


On Sun, Aug 31, 2014 at 1:28 AM, Temlin Olivér <temlin at gmail.com> wrote:

> > Whenever I start my laptop up, /home takes ~17-19 seconds to mount
> You can always use x-systemd.automount in fstab, which delays the mount to
> the first access (ie. non-root login), or mask home.mount to be
> non-blocking (oneshot), so it runs parallel with the login manager and
> password input.
> Slow mount times are usually caused by large log trees and fragmented
> metadata. Try the autodefrag mount option and btrfs fi defrag -clzo -t 2M
> -r /home (defragment files over 2M in size, recompress with lzo,
> recursively), btrfs balance start /home (and wait for btrfs-endio-wri to
> calm down or check with balance status, this takes some time)
> If those don't help enough, try checking (but not repairing) the device
> with btrfsck, and, if it's clean, clear the logs with btrfs-zero-image
> after backing up the metadata with btrfs-image (consult the btrfs mailing
> list or IRC first, I am not an expert in this).
>
> > Running df -h on my system, I get:
> > /dev/sda5         422G   364G   53G   88%        /home
> Please use btrfs filesystem df (fi df for short), as it will show you both
> the data and metadata allocation with better reflection on actual free data
> space.
>
> Point is, the allocation on B* trees can only be measured by a full tree
> traversal (as your du try shows the true data usage, but misses
> fragmentation), but btrfs usage is even more complicated. Authors suggest
> that a device never be filled over 75% to avoid metadata fragmentation, but
> by having larger files this can truly be about 95%.
>
> Sorry for the long text, but I belive this helps in better understanding.
>
> --Oliver Temlin
>

I defragged the filesystem and balanced it, before scrubbing it for good
measure, and then rebooted. The problems with the long booting time
disappeared (without using the systemd mount option in fstab). However,
xdiskusage still shows /home/(permission denied) to be about 30 gigs.

I realise that that space might be in use by the FS for some reason and
trying to recover it might be beyond me. Keeping used space at below 75%
does seem to help a lot. However, this is a slightly weird expectation for
a mainline filesystem. If I have a 2TB external hard disk (which I'm
thinking of buying in a few days), formatting it with btrfs seems an easy
way to convert it to a 1.5TB without really gaining substantial benefits. I
guess XFS and Ext4 really are better for this use case.

I'd like to thank everyone for the help I got on this issue, especially
Oliver Temlin, whose inputs managed to help me solve this neatly. I also
got to learn a lot about btrfs, which is a big plus.

Cheers,
Savya

-- 
Savyasachee Jha

*"Aerodynamics is for people whodon't know how to build engines."*


More information about the arch-general mailing list