[zfs-discuss] scripting the end of a scrub

Steven Burgess sburgess at dattobackup.com
Wed May 22 10:15:28 EDT 2013


There is this issue on github:

https://github.com/zfsonlinux/zfs/issues/2

it describes an events system for this kind of thing, looks like there is
still work to do on it. Until we get something implemented you can read
through the comments to see how other peoples solutions.


On Wed, May 22, 2013 at 7:58 AM, Ryan How <ryan at zbit.net.au> wrote:

>  On 22/05/2013 7:54 PM, LosingMy ZFS wrote:
>
> I need to write a script that initiates a scrub, waits for it to
> finish, then upon completion resumes running the script.  I can't seem
> to find a way to do this easily; zpool status (pool) always returns a
> zero even when a scrub is in progress.
>
> Has anyone already done something like this?  I suppose I could fire
> off a cron job once a minute looking at zpool status and parse out
> what I need, but that feels... ugly.
>
> Thanks!
>
>
>
> I'm not sure if this helps. This is from a previous thread [zfs-discuss]
> How to wait for scrub to be terminated?:
>
>
>
>
>
> On Wed, Jan 2, 2013 at 10:14 PM, mabra <mabra77 at gmail.com> wrote:
>
>> Hi !
>>
>> Thanks, well done. BTW, is this probably written to /proc/** ??
>
>
>  Not that Im aware of.
>
>
>> This way, I would take a high level language to query the value.
>>
>> Best regards,
>>
>> ++mabra
>>
>>
>>
>> On Wednesday, January 2, 2013 9:02:08 PM UTC+1, Cyril Pilsko wrote:
>>
>>>  zpool events -v
>>>
>>>  Jan  2 2013 19:59:54.239713000 ereport.fs.zfs.scrub.start
>>>         class = "ereport.fs.zfs.scrub.start"
>>>         ena = 0x8ea54e825df01401
>>>         detector = (embedded nvlist)
>>>                 version = 0x0
>>>                 scheme = "zfs"
>>>                 pool = 0x46cd211379bc5762
>>>         (end detector)
>>>         pool = "dpool"
>>>         pool_guid = 0x46cd211379bc5762
>>>         pool_context = 0x0
>>>         pool_failmode = "wait"
>>>         time = 0x50e491ba 0xe49bae8
>>>
>>>  Jan  2 2013 19:59:54.353381000 ereport.fs.zfs.scrub.finish
>>>         class = "ereport.fs.zfs.scrub.finish"
>>>         ena = 0x8ea5bae977c00401
>>>         detector = (embedded nvlist)
>>>                 version = 0x0
>>>                 scheme = "zfs"
>>>                 pool = 0x46cd211379bc5762
>>>         (end detector)
>>>         pool = "dpool"
>>>          pool_guid = 0x46cd211379bc5762
>>>         pool_context = 0x0
>>>         pool_failmode = "wait"
>>>         time = 0x50e491ba 0x15102a88
>>>
>>>
>>>  Note 'pool' field
>>>
>>>
>>> On Wed, Jan 2, 2013 at 9:56 PM, mabra <mab... at gmail.com> wrote:
>>>
>>>> Hi !
>>>>
>>>> Thanks.
>>>> This seems not to be documented ... ;-)
>>>> But, after seeing the output, it does not seem to bring me really
>>>> further ...
>>>> There is nothing in the ouput, which shows me which pool it was ...
>>>> Parsing >zpool status [mypool]
>>>> would even give me the values.
>>>>
>>>> Anyway, thanks.
>>>>
>>>> ++mabra
>>>>
>>>>
>>>>
>>>> On Wednesday, January 2, 2013 8:48:31 PM UTC+1, Cyril Pilsko wrote:
>>>>
>>>>>  Hi mambra,
>>>>>
>>>>>  You may want to check 'zpool events' command. As soon as scrub will
>>>>> complete the appropriate event will be posted there.
>>>>>
>>>>>
>>>>>  On Wed, Jan 2, 2013 at 6:49 PM, mabra <mab... at gmail.com> wrote:
>>>>>
>>>>>> Hi !
>>>>>>
>>>>>> I am looking for a scriptable was to sync a script to the end of
>>>>>> scrub. It's just that,
>>>>>> I have to obtain status and then shutdown the box. Does'nt look the
>>>>>> right way for me:
>>>>>> shell a scrub and parse the output .... each second? Minute ?? There
>>>>>> is probably
>>>>>> a better way, probably even with getting the results directly.
>>>>>>
>>>>>> Any thought are really welcome!
>>>>>>
>>>>>> br,
>>>>>> ++mabra
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>  --
>>>>> Regards,
>>>>>         Cyril
>>>>>
>>>>
>>>
>>>
>>>  --
>>> Regards,
>>>         Cyril
>>>
>>
>
>
>  --
> Regards,
>         Cyril
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.zfsonlinux.org/pipermail/zfs-discuss/attachments/20130522/01cab522/attachment.html>


More information about the zfs-discuss mailing list