Skip to content

Instantly share code, notes, and snippets.

@elreydetoda
Last active October 23, 2019 02:55
Show Gist options
  • Save elreydetoda/f8e77579b572c95549cfadbd0d151410 to your computer and use it in GitHub Desktop.
Save elreydetoda/f8e77579b572c95549cfadbd0d151410 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
zpool export -a
zpool import -N -R /mnt rpool
zpool import -N -R /mnt bpool
# skipping first rpool/ROOT and initial root (i.e. rpool/ROOT/ubuntu), because doesn't have tailing '/' so grabs numbers
zfs list | grep ROOT | tail -n+3
zfs mount rpool/ROOT/ubuntu
zfs mount -a
mount --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
chroot /mnt /bin/bash --login
#!/usr/bin/env bash
# get out of chroot
# type exit or Ctrl + d
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {}
zpool export -a
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment