Skip to content

btrfs scrub status on a single drive produces erroneous output #1102

Description

@julie777

When a scrub is being run on a single drive of an array, the scrub status report is based on the used size of the entire array which causes progress to be inaccurate and confused the user.

The output would be more meaningful information if instead of using the "Used Total" from filesystem show it used the "Used space" on that drive.

Device usage information (partial) for illustration:

$ sudo btrfs fi usage /mnt/btrfs/
Overall:
    Device size:                  54.57TiB
    Device allocated:             30.10TiB
    Device unallocated:           24.47TiB
    Device missing:                  0.00B
    Device slack:                  3.64TiB
    Used:                         28.79TiB   ****1

Data,RAID1: Size:14.99TiB, Used:14.36TiB (95.80%)
   /dev/sda        7.74TiB
   /dev/sdb        7.74TiB
   /dev/sde        7.74TiB
   /dev/sdc        6.76TiB            ****2

Scrub status uses the "Used" value (1) for the total even if only one of the drives is being scrubbed.
By using the used value (2) for the drive being scrubbed the progress is much more accurate.

I actually ran the output of scrub status through a short program that used the "device in use total" and calculated new values giving me the additional output based on only one device. As the scrub progressed my output was much more accurate as to the percent complete and the time remaining.
Example output below.
(The output below is not from the single device scrub, so the status output and my additional output are not consistent in the example, as I am currently running a scrub on the entire filesystem.) The additional info is showing /dev/sdc from the above file system.

UUID:             8d1f6eb3-84cc-4869-8cf5-c5e39a6f2f53
Scrub started:    Fri Mar 27 10:05:14 2026
Status:           running
Duration:         0:26:51
Time left:        13:22:13
ETA:              Fri Mar 27 23:54:20 2026
Total to scrub:   28.79TiB
Bytes scrubbed:   954.60GiB  (3.24%)
Rate:             606.78MiB/s
Error summary:    no errors found

Total bytes   :   6.79 TB
Bytes scrubbed: 954.60 GB
Bytes left    :   5.84 TB
Percent       :     14.06
Time left     :   2:40:17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions