Skip to content

Instantly share code, notes, and snippets.

@tosih
Created June 7, 2019 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tosih/7151a4105e90b87c6ea8f736f539d660 to your computer and use it in GitHub Desktop.
Save tosih/7151a4105e90b87c6ea8f736f539d660 to your computer and use it in GitHub Desktop.
Steps used to hot swap a failing disk in my OSX ZFS pool
#!/usr/bin/env bash
# Export pool to reimport with the less safe (because they vary) BSD disk names in /dev,
zpool export Data
zpool import -d /dev Data
# Take down faulty disk
zpool offline Data /dev/<faulty_disk>
# Replace physical disk
zpool online Data /dev/<faulty_disk>
# Start resilver process to repair pool (should be the same name)
zpool replace Data /dev/<new_disk>
# Export pool to reimport with the names in /var/run/disk/by-id
zpool export Data
zpool import -d /private/var/run/disk/by-id Data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment