3

I have a btrfs RAID1 array (two 891GiB partitions on two HDDs) on my laptop. When I run btrfs balance it takes a huge amount of time to complete.

I know if I would like to balance the whole filesystem it would take forever, that's why I'm using the -usage filter like this; I've put this in the for loop because I don't always know with which number to start.

for i in {1..100}; do sudo btrfs balance start -dusage=$i /my/mount/path/; done

In this loop, sudo only asks my password the first time, or if the balance took a lot of time. This prints about 20 times

Done, had to relocate 0 out of 868 chunks

And then after taking a huge amount of time it prints

Done, had to relocate 1 out of 868 chunks

So it means it has only moved 1GB (or 200MB) of data. It just shouldn't take that much time to move just 1GB of data, I can copy much more data to this filesystem in a tenth of the time.

This is the entry on my fstab:

UUID=<the uuid>  /my/mount/path/  btrfs  defaults,noatime,compress=lzo  0  0

I also have to mention that I usually make and also delete snapshots just in case I make something wrong.

sudo btrfs subvolume list /my/mount/path/
ID 5238 gen 178224 top level 5 path SNAP/snap-2017-04-15
ID 5270 gen 178229 top level 5 path SNAP/snap-2017-04-17
ID 5272 gen 178228 top level 5 path SNAP/snap-2017-04-21
ID 5276 gen 178230 top level 5 path SNAP/snap-2017-04-25
ID 5284 gen 178232 top level 5 path SNAP/snap-2017-05-04
ID 5290 gen 178231 top level 5 path SNAP/snap-2017-05-10
ID 5291 gen 178229 top level 5 path SNAP/snap-2017-05-11
ID 5309 gen 178225 top level 5 path SNAP/snap-2017-05-11-22-52-30
ID 5310 gen 178226 top level 5 path SNAP/snap-2017-05-13
ID 5311 gen 178232 top level 5 path SNAP/snap-2017-05-15
ID 5312 gen 178227 top level 5 path SNAP/snap-2017-05-17
ID 5313 gen 178227 top level 5 path SNAP/snap-2017-05-18

I also have quotas enabled to help me see how much has been modified between snapshots.

sudo btrfs qgroup show /my/mount/path/
qgroupid         rfer         excl
--------         ----         ----
0/5         774.25GiB    910.87MiB
0/3098      142.21GiB        0.00B
0/3119       39.38GiB     16.00EiB
0/5226          0.00B     16.00EiB
0/5228          0.00B     16.00EiB
0/5233       48.00KiB     16.00EiB
0/5236       96.00KiB     16.00EiB
0/5238      785.18GiB     46.57GiB
0/5270      768.99GiB      1.22MiB
0/5272      768.73GiB      1.36MiB
0/5276      766.70GiB     12.70MiB
0/5284      768.55GiB      3.33MiB
0/5290      772.23GiB    964.00KiB
0/5291      772.23GiB    912.00KiB
0/5309      773.77GiB    608.00KiB
0/5310      773.78GiB      1.09MiB
0/5311      773.56GiB      1.66MiB
0/5312      773.55GiB      2.16MiB
0/5313      774.32GiB    147.49MiB

The 16.00EiB must be some kind of mistake, Who has such a HDD?

Why does balance take that long to complete? I really like the btrfs features, so I prefer to stay with it.

3

I finally figured it out. The reason why it was taking so much time was because of the quota.

I disabled it running:

sudo btrfs quota disable /my/mount/path/

Now it balances my fs in just a few minutes.

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.