-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrub configuration when subvolid=5 is not mounted #105
Comments
Hi Norbert!
Cool to hear you're using btrfs :-)
Norbert Preining ***@***.***> writes:
I would like to scrub the whole btrfs multi-device filesystem, but I have only mounted subvolumes (also root is a subvolume). Is there a way the configure btrfsmaintainence to scrub the whole filesystem and not only the mounted subvolumes without manually mounting subvolid=5 to a dir and starting `btrfs scrub dir`?
Scrub operates at the volume rather than subvolume level. To test this,
create a subvolume, fill it with a small amount of data, then
btrfs scrub start @test_subvol
btrfs scrub status @test_subvol
You'll see that "Total to scrub" is surprisingly large ;-)
The default `BTRFS_SCRUB_MOUNTPOINTS="auto"` in
/etc/default/btrfsmaintenance will scrub all mounted volume. Eg: if
four disks are in two raid1 profile volumes, and both volumes are
mounted, it will scrub them both.
|
Correction: "operates at the volume level" is not truly accurate. The
man page is not clear if `btrfs scrub /dev/sdb`, for a two disk raid1
profile volume will also scrub /dev/sda, but seems to indicate that it
won't. I've never tested that functionality. IIRC scrubs do work on
lower level data structures, but I can't remember which one.
|
The man page says:
Do you have a suggested rewording to make that clearer? In the kernel, scrub is a device-level operation. For convenience, the userspace
only blocks on /dev/sdb will be checked or repaired. If you run scrub on the mountpoint:
the result is equivalent to:
except the userspace tool will try to prevent that because the tool's progress and status reporting doesn't support what the kernel can do. The kernel doesn't care, so if you invoke the bare scrub ioctl on the individual devices, the kernel will happily scrub each device sequentially or in parallel, as long as there are not two scrubs running on the same device at the same time. Scrub checks metadata blocks that are not part of any file (and therefore not part of any subvolume), such as filesystem superblocks and the free space tree. Scrub couldn't work by subvolume without fundamentally redefining what scrub is. The (*) If you give scrub a device, scrub will find a mount point for the filesystem so it can run the ioctl, then resolve the device back to a btrfs devid so it can run scrub on the device. btrfs is complicated. |
Hi @sten0 Let us summarize what I think I have understood or learned
Now indeed, if I start a scrub on /home (which is a subvolume mounted), I see the full size:
But honestly, the speed is a bit too fast for my understanding: 2.48GiB/s ... is this reasonable? Also, looking at the time it should finish in about 1h. Yesterday I mounted subvolid=5 and run the scrub on that mount point and it took about 5 hours. So looking at the time and speed, it seems that despite the But all these are wild guesses ... |
I would like to scrub the whole btrfs multi-device filesystem, but I have only mounted subvolumes (also root is a subvolume). Is there a way the configure btrfsmaintainence to scrub the whole filesystem and not only the mounted subvolumes without manually mounting subvolid=5 to a dir and starting
btrfs scrub dir
?The text was updated successfully, but these errors were encountered: