We have moved to a new Sailfish OS Forum. Please start new discussions there.
13

New btrfs-balance service in 1.1.4 seems to ignore battery percentage gate

asked 2015-04-17 13:50:11 +0200

vitaminj gravatar image

updated 2015-04-17 14:21:04 +0200

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.

edit retag flag offensive close delete

Comments

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 )edit
1

Things 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 )edit

Is 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 )edit

Battery 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

2 Answers

Sort by » oldest newest most voted
5

answered 2015-04-17 16:11:00 +0200

pycage gravatar image

"if test check_balance_need; then" looks wrong to me; it should be "if check_balance_need; then" AFAIK.

The btrfs-balance service is from https://github.com/sailfishos/btrfs-balancer on github, but as you can see, the project has changed a lot since the version that made it into SailfishOS 1.1.4, and this bug no longer exists. as the script no longer exists. :) If you're brave you may try the new version from github and report any problems you find.

edit flag offensive delete publish link more
2

answered 2015-04-28 23:58:11 +0200

Trizt gravatar image

With 1.1.4.28 I had a -dusage=96 running for 8 hours, it gave me 0 bytes more space. Running the following manually gave me maximum free space less than 5 minutes:

btrfs balance start -musage=15 /

btrfs balance start -musage=25 /

btrfs balance start -musage=35 /

btrfs balance start -musage=45 /

btrfs balance start -musage=55 /

btrfs balance start -musage=65 /

btrfs balance start -musage=75 /

btrfs balance start -musage=85 /

btrfs balance start -musage=95 /

btrfs balance start -dusage=5 /

btrfs balance start -dusage=10 /

btrfs balance start -dusage=15 /

btrfs balance start -dusage=20 /

Notice that I first run the metadata only, this can lead to more space reserved by btrfs, but it speeds up the data balancing A LOT, from 12.76 to 9.73. Filesystem has used 9.6G.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
7 followers

Stats

Asked: 2015-04-17 13:50:11 +0200

Seen: 1,110 times

Last updated: Apr 28 '15