mirrored raid, how do I know when it is degraded?

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

mirrored raid, how do I know when it is degraded?

Postby e8vww » Fri Nov 24, 2017 2:17 pm

I want to switch as much as possible to ZFS after experiencing a severe bitrot problem across dozens of "JBOD" HFS drives.

My noob questions:

How will I receive notification of a failed drive with a mirrored raid (is there a way to have desktop notifications)?

Has raid expandability been fully implemented? (I've only seen a twitter post about it so far)

Is there anything I need to be aware of before mass migration, ie will the drives function in the same plug and play manner?

Will the drives appear the same to someone viewing them over the network?

Edit: Is booting from a ZFS drive ready for regular users?

Thanks all!
e8vww
 
Posts: 51
Joined: Fri Nov 24, 2017 2:06 pm

Re: mirrored raid, how do I know when it is degraded?

Postby lundman » Sun Nov 26, 2017 4:58 pm

e8vww wrote:How will I receive notification of a failed drive with a mirrored raid (is there a way to have desktop notifications)?


The daemon 'zed' (ZFS Event Daemon) gets the notifications from the kernel regarding everything ZFS. 'Zed' will then execute shell scripts based on the notification type, for example it ships with a few scripts like "zpool.import.sh" which is run at import time, and contains code like:

Code: Select all
# OS X notification script.
function notify {
        sudo -u "$(stat -f '%Su' /dev/console)" /usr/bin/osascript -e 'display notification "'"$1"'" with title "'"$2"'"'
}

notify "Pool ${ZEVENT_POOL} ${cmd}ed." "Pool ${cmd}"


To attempt to do a Desktop notification. I do not remember if it still works though, since Apple tends to change how things work.

But it is meant to be a framework for you to do whatever you want. Have the script send you an email, or SMS, or anything. Some of these scripts are from Linux and won't run directly out of the box, but provided as a template. It would be nice if the zedlets were customised for OSX.

e8vww wrote:Has raid expandability been fully implemented? (I've only seen a twitter post about it so far)


No, it is coming, but not here yet. But that specifically talks about the situation where you want to go from a 4 disk raidz vdev to a 5 disk raidz vdev. (Or similar, changing the number of drives in a vdev). You can already expand your pool by expanding each disk in the vdev one-at-a-time, or, adding another whole vdev. (You can add another 4 disk raidz vdev, to an existing 4 disk raidz vdev).

e8vww wrote:Is there anything I need to be aware of before mass migration, ie will the drives function in the same plug and play manner?


Apple takes care of everything up to "diskutil list", so everything is the same in that sense. ZFS uses the disks as presented by the OS.

e8vww wrote:Will the drives appear the same to someone viewing them over the network?


You can export the ZFS datasets over the network, either by yourself, or by setting "zfs set sharenfs=... dataset" (or sharesmb / shareafp) The raw disks are not shared over the network individually, ZFS bundle them together to be one large-pool-of-storage that you divide up however you like, and export as needed.

e8vww wrote:Edit: Is booting from a ZFS drive ready for regular users?


Not really. ZVOL hfs boot is being used by a few devs, but it is a bit fiddly to setup and boot.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: mirrored raid, how do I know when it is degraded?

Postby e8vww » Wed Dec 06, 2017 11:42 pm

lundman wrote:
e8vww wrote:How will I receive notification of a failed drive with a mirrored raid (is there a way to have desktop notifications)?


The daemon 'zed' (ZFS Event Daemon) gets the notifications from the kernel regarding everything ZFS. 'Zed' will then execute shell scripts based on the notification type, for example it ships with a few scripts like "zpool.import.sh" which is run at import time, and contains code like:

Code: Select all
# OS X notification script.
function notify {
        sudo -u "$(stat -f '%Su' /dev/console)" /usr/bin/osascript -e 'display notification "'"$1"'" with title "'"$2"'"'
}

notify "Pool ${ZEVENT_POOL} ${cmd}ed." "Pool ${cmd}"


To attempt to do a Desktop notification. I do not remember if it still works though, since Apple tends to change how things work.

But it is meant to be a framework for you to do whatever you want. Have the script send you an email, or SMS, or anything. Some of these scripts are from Linux and won't run directly out of the box, but provided as a template. It would be nice if the zedlets were customised for OSX.


Is there a command I can use to test the notifications? Other than pulling one of the drives?

EDIT: Did not receive a desktop notification when a drive was pulled.
e8vww
 
Posts: 51
Joined: Fri Nov 24, 2017 2:06 pm

Re: mirrored raid, how do I know when it is degraded?

Postby e8vww » Fri Dec 08, 2017 6:42 pm

lundman wrote:Have the script send you an email, or SMS, or anything. Some of these scripts are from Linux and won't run directly out of the box, but provided as a template. It would be nice if the zedlets were customised for OSX.


Where do I edit the ZED_NOTIFY_INTERVAL_SECS and enter an email for notifications?

I have no idea how to edit the included .sh, or to check if its being executed properly. If its written correctly it will be triggered on every boot? Or only when I create the pool and that one time run is enough?

Here is the relevant page on apple developer: https://developer.apple.com/library/con ... tions.html

and the list of .sh files:

all-debug.sh
all-syslog.sh
checksum-notify.sh
checksum-spare.sh
config.remove.sh
config.sync.sh
data-notify.sh
generic-notify.sh
io-notify.sh
io-spare.sh
resilver.finish-notify.sh
scrub.finish-notify.sh
snapshot.mount.sh
zpool.destroy.sh
zpool.import.sh
zvol.create.sh
zvol.remove.sh
e8vww
 
Posts: 51
Joined: Fri Nov 24, 2017 2:06 pm

Re: mirrored raid, how do I know when it is degraded?

Postby lundman » Mon Dec 11, 2017 5:43 pm

I've not got to checking the scripts yet, I suspect the send email script works on linux just fine but perhaps not on OSX without some tweaks.

I use the import/export of pool script to test various functions, as its easy to trigger without having to pull a disk.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: mirrored raid, how do I know when it is degraded?

Postby e8vww » Fri Dec 22, 2017 8:36 pm

lundman wrote:I've not got to checking the scripts yet, I suspect the send email script works on linux just fine but perhaps not on OSX without some tweaks.

I use the import/export of pool script to test various functions, as its easy to trigger without having to pull a disk.


For now I'll just 'zpool status' every day/week. If a script person wrote a fewtemplates with INSERT_EMAIL_HERE type simplicity it would make catching failed drives much easier. That said...thanks to all the devs who have made zfs on osx as easy as it is!
e8vww
 
Posts: 51
Joined: Fri Nov 24, 2017 2:06 pm

Re: mirrored raid, how do I know when it is degraded?

Postby Wowfunhappy » Wed Aug 01, 2018 9:40 am

Apologies in advance for asking such obviously newbie questions, but which script exactly do I need to edit for the specific case of a degraded disc?

That notification script you posted does indeed work. However, the relevant code block does not appear to be in any of the other scripts, which is probably why it didn't work when e8vww tried pulling a drive!
Wowfunhappy
 
Posts: 33
Joined: Sat Jul 21, 2018 11:58 am

Re: mirrored raid, how do I know when it is degraded?

Postby Wowfunhappy » Fri Jan 11, 2019 1:18 pm

I cannot seem to make the scripts work.

I edited both the data-notify and checksum-notify scripts to add a send notification block. When I run the script in the terminal, the notification appears! But when I disconnect a drive, nothing happens. :(
Wowfunhappy
 
Posts: 33
Joined: Sat Jul 21, 2018 11:58 am

Re: mirrored raid, how do I know when it is degraded?

Postby lundman » Mon Jan 14, 2019 3:52 pm

If you unload zed from launchctl - and run it by hand in a window (sudo) - I believe you can have it print out the events as it gets them, and what scripts it tries to run etc. That would be the first step I would do to debug zed and events.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 13 guests