On 09/01/2020 10:34, Holger Hoffstätte wrote: > On 1/9/20 11:03 AM, Sebastian Döring wrote: >> Maybe I'm doing it entirely wrong, but I can't seem to get 'btrfs >> scrub resume' to work properly. During a running scrub the resume >> information (like data_bytes_scrubbed:1081454592) gets written to a >> file in /var/lib/btrfs, but as soon as the scrub is cancelled all >> relevant fields are zeroed. 'btrfs scrub resume' then seems to >> re-start from the very beginning. >> >> This is on linux-5.5-rc5 and btrfs-progs 5.4, but I've been seeing >> this for a while now. >> >> Is this intended/expected behavior? Am I using the btrfs-progs wrong? >> How can I interrupt and resume a scrub? > > Using 5.4.9+ (all of btrfs-5.5) and btrfs-progs 5.4 I just tried and > it still works for me (and always has): > > $btrfs scrub start /mnt/backup > scrub started on /mnt/backup, fsid d163af2f-6e03-4972-bfd6-30c68b6ed312 > (pid=25633) > > $btrfs scrub cancel /mnt/backup > scrub cancelled > > $btrfs scrub resume /mnt/backup > scrub resumed on /mnt/backup, fsid d163af2f-6e03-4972-bfd6-30c68b6ed312 > (pid=25704) > > ..and it keeps munching away as expected. Can you check that the resume has really started from where the scrub was cancelled? What I (and, I think, Sebastian) are seeing is that the resume "works" but actually restarts from the beginning. For example, something like: btrfs scrub start /mnt/backup sleep 300 btrfs scrub status -R /mnt/backup btrfs scrub cancel /mnt/backup btrfs scrub resume /mnt/backup sleep 100 btrfs scrub status -R /mnt/backup and check the last_physical in the second status is higher than the one in the first status.
