New btrfs-balance service in 1.1.4 seems to ignore battery percentage gate
Tipped off by the mega btrfs thread, I was checking out the new-in-1.1.4 btrfs-balance command.
It works great when run manually. No longer blocks and wastes CPU with a silent failure if there isn't enough space (forcing you to do a scary reboot), and I didn't get any angry system watchdogs restarting services during the process either.
But I notice that the script is set to not run if the device battery is below 25%. This check appears to be ignored though, when I run the task manually. If I prefix the "if test check_balance_need; then" block with a direct call to "check_balance_need" it seems to work as expected.
I'm aware that I'm running it manually, and not triggering it as a systemd task, so the shell env may be slightly different when it's run "for real", but it worried me anyway.
Also, should the battery level check not be done before each of the -dusage iterations? On a highly fragmented device each iteration takes a little while and could potentially run the device to nearly empty overnight, especially if the user leaves IM clients or something active.
And finally! Should a "no space left on device" failure (as I got at the second-to-last iteration when my device claimed to be 11gb full in settings) push a notification or something? "Not enough room to perform system maintenance, please free up some space"? Although I thought an alleged 2.7gb free would be enough? Freed up down to 10.4gb and it was happier.
Has any statistic been collected on how many % points of battery chanrge can (on average) a btrfs balance take?
simosagi ( 2015-04-21 11:16:09 +0200 )editThings may have changed with later versions and in a way how btrfs-command does balancing in several incremental runs, so what I say below may be obsolete.
Of the full balance I have the experience that it will take that 25% for the first run ever. Say, in case where one has been using Jolla for a year for instance. But it the end it really depends on usage patterns during that time. Huge amount of small files, such as in android app Tripadvisor where you can cache data locally, it will take ages.
I don't recommend to run it first time with anything under 40% to be sure.
Later runs will take only 2 - 8 % and are a lot faster.
Manatus ( 2015-04-21 15:00:20 +0200 )editIs there a way to know whether the scheduled task actually ran? A logfile or something? btrfs fi show still shows 13.75GB used for devid 1. Also, if I want to run this task manually, is it enough to just run /usr/sbin/btrfs-balance as root?
thisisme ( 2015-06-03 10:10:45 +0200 )editBattery value is now properly taken into account with new btrfs-balancer command in Aaslakkajärvi. Not sure that the timer works anymore, though. Even when connected to a charger...
Manatus ( 2015-06-09 10:11:00 +0200 )edit