Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Last active August 29, 2015 14:20
Show Gist options
  • Save tylerflint/2a4b63d50e32b770ff3f to your computer and use it in GitHub Desktop.
Save tylerflint/2a4b63d50e32b770ff3f to your computer and use it in GitHub Desktop.
SmartOS recover from zfs core dump reboot cycle
  1. boot into option that does not import the dataset (noimport=true)

  2. import the zones zpool without mounts

zpool import -N zones
  1. scrub the zones pool to ensure data consistency
zpool scrub zones  
  1. remove the mirrors from zones. For every mirror in zpool status zones, remove the second disk:
zpool detach zones c0t67d0
zpool detach zones c0t69d0
zpool detach zones c0t71d0
zpool detach zones c0t73d0
zpool detach zones c0t75d0
  1. now create a new pool from the disks we just removed
zpool create zones1 c0t67d0 c0t69d0 c0t71d0 c0t73d0 c0t75d0
  1. create a recursive snapshot of zones and all descendent filesystems
zfs snapshot -r zones@now
  1. send the snapshot and all descendant filesystems to zones1
zfs send -R zones@now | zfs recv -F zones1
  1. destroy zones zpool
zpool destroy zones
  1. rename zones1 to zones
zpool export zones1
zpool import zones1 zones
  1. add the leftover drives from the delete zones to re-enable mirroring
zpool attach zones c0t67d0 c0t66d0
zpool attach zones c0t69d0 c0t68d0
zpool attach zones c0t71d0 c0t70d0
zpool attach zones c0t73d0 c0t72d0
zpool attach zones c0t75d0 c0t74d0
  1. wait for resilver to complete
zpool status zones
  1. recreate the l2arc
zpool add -f zones cache c0t64d0s3 c0t65d0s3
  1. recreate the zil
zpool add -f zones log mirror c0t64d0s1 c0t65d0s1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment