Skip to content

Instantly share code, notes, and snippets.

@elreydetoda
Last active October 23, 2019 03:07
Show Gist options
  • Save elreydetoda/97c72f7bf4b7ee862a39de176957d723 to your computer and use it in GitHub Desktop.
Save elreydetoda/97c72f7bf4b7ee862a39de176957d723 to your computer and use it in GitHub Desktop.
these are the zfs mount and unmount commands based on this: https://github.com/zfsonlinux/zfs/wiki/Ubuntu-18.04-Root-on-ZFS#troubleshooting
#!/usr/bin/env bash
## run all commands by doing
# curl -fsSL 'https://git.io/Je0e6' | sudo bash
## running mount commands
curl -fsSL 'https://git.io/Je0eX' | sudo bash
## running umount commands
# get out of chroot
# type exit or Ctrl + d
curl -fsSL 'https://git.io/Je0eP' | sudo bash
#!/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
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {}
zpool export -a
echo 'you have everything ready, you should reboot'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment