Last active
April 2, 2017 00:54
-
-
Save michaelsproul/c5e933539ebbd35d0fd3fa5e8a8e6c98 to your computer and use it in GitHub Desktop.
Slightly broken script to automatically import ZFS pools from an external HDD on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>zfsautoimport</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/zpool</string> | |
<string>import</string> | |
<string>-a</string> | |
</array> | |
<key>KeepAlive</key> | |
<false/> | |
<key>RunAtLoad</key> | |
<false/> | |
<key>LaunchEvents</key> | |
<dict> | |
<key>com.apple.iokit.matching</key> | |
<dict> | |
<key>com.apple.device-attach</key> | |
<dict> | |
<key>idProduct</key> | |
<integer>8986</integer> | |
<key>idVendor</key> | |
<integer>3010</integer> | |
<key>IOProviderClass</key> | |
<string>IOUSBDevice</string> | |
<key>IOMatchLaunchStream</key> | |
<true/> | |
</dict> | |
</dict> | |
</dict> | |
<key>StandardErrorPath</key> | |
<string>/private/var/log/zfsautoimport.err</string> | |
<key>StandardOutPath</key> | |
<string>/private/var/log/zfsautoimport.log</string> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current bug: the OS fires another connect event when exporting the storage pool, so it gets stuck in an import loop!
Can probably fix this by monitoring a different event, saw something somewhere about disk arbitration - that would probably work better.