I am writing a script to facilitate the partial automation of backups, and I have a single drive pool that goes in a hot swap on ada3.
It is very easy to determine if a drive is plugged in
The only idea that I can see as a possibility is This command takes awhile to return, but other than the delay which is a bit scary, is there any significant risk?
(Sorry I'm a real ZFS NOOB, so I want to make sure I'm not doing something stupid.)
If for some reason there was more than one pool unmounted, the script could run into trouble without manual intervention.
to match the two together, but again it's a lot of work and there are no "script friendly" options for
Any "hints" or suggestions would be much appreciated.
It is very easy to determine if a drive is plugged in
diskinfo -s $backupdevice
:- command fails - no drive mounted
- get a serial number - drive mounted
The only idea that I can see as a possibility is
zpool import
, but it doesn't have "script friendly options, so it's not the easiest thing to work with.Code:
#>zpool import pool: BACKUP01 id: 5978781716520886925 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: BACKUP01 ONLINE gptid/8d86d52b-edf9-11e7-aadb-001517d3287a ONLINE
(Sorry I'm a real ZFS NOOB, so I want to make sure I'm not doing something stupid.)
If for some reason there was more than one pool unmounted, the script could run into trouble without manual intervention.
glabel status
can be used to find the gptidCode:
Name Status Components [REMOVED] gptid/8d7a9f48-edf9-11e7-aadb-001517d3287a N/A ada3p1 gptid/8d86d52b-edf9-11e7-aadb-001517d3287a N/A ada3p2
glabel either
.Any "hints" or suggestions would be much appreciated.