On Tue, 2013-04-02 at 07:30 -0400, Dan Ritter wrote: > On Tue, Apr 02, 2013 at 12:12:10PM +0100, Jonathan Dowland wrote: > > On Mon, Apr 01, 2013 at 05:25:48PM +0200, Steven Post wrote: > > > But what if the system is powered down during a scrub? Will it continue > > > when it boots up again? > > > All assuming the scrub is started with 'btrfs scrub start -B <path>'. > > > > Why not start a scrub on reboot via @reboot in cron, too. Or would you > > prefer it if you didn't always scrub upon boot? > > On my newly built system, a btrfs scrub across two disks (data > and metadata both RAID1) runs at about 10GB per minute. That's > GB of data/metadata in-use, not disk capacity. Still, when you > have a 2TB filesystem that's mostly full, a scrub will take more > than three hours. As Dan mentions here, a scrub could easily take over 3 hours, depending on the data size, so it seems like a bad idea to run it at every startup, which is effectively daily. For reference, my last scrub on a 6 disk raid 10 btrfs system took 6549 seconds, just under 2 hours, with 3.32 TB scrubbed. I'm thinking weekly or even monthly. > > You can't stop people shutting down their systems, but you can > pause a scrub. > > btrfs scrub cancel DEVICE > > in the shutdown script, and > > btrfs scrub resume DEVICE > > in the startup script will pick it up from where it left off. Excellent, if I'm reading this and the man page correctly, I can put 'btrfs scrub start -B <path>' into anacron and add the cancel command to the shutdown script. Then a cronjob with @reboot that executes the following script: #!/bin/sh SCRUBRESULT=`btrfs scrub resume -B <path>` if ! echo "$SCRUBRESULT" | grep -q "nothing to resume" ; then echo "$SCRUBRESULT" fi That should do it right? > > Or, you could solve this with a social cue: "please don't turn > off desktops on weekends. We run maintenance then." In a first stage I plan to do this on 2 of my own devices, a desktop and a laptop, but if possible I don't want to leave the devices powered on unless necessary. > > -dsr- > >
Attachment:
signature.asc
Description: This is a digitally signed message part