zfs grub rescue

Boot into rescue linux
Setup the root zfspool and mounts
zfs set mountpoint=/mnt rpool/ROOT/pve-1
rm -rf /mnt/*
zfs mount rpool/ROOT/pve-1
mount -t proc /proc /mnt/proc
mount –rbind /dev /mnt/dev
mount –rbind /sys /mnt/sys
#Enter the chroot
chroot /mnt /bin/bash
source /etc/profile
You are now in the chroot
#fix apt and reinstall the required utils
dpkg –configure -a
apt-get update && apt-get dist-upgrade -y
apt-get install –reinstall grub-pc
apt-get install –reinstall zfs-initramfs
apt-get install –reinstall pve-kernel-4.4 linux-image-amd64
#install and configure
grub-install /dev/disk/by-id/
grub-install /dev/disk/by-id/
update-grub2
for x in $(cat /proc/cmdline); do case $x in root=ZFS=*) BOOT=zfs; ;; esac; done
grub-probe /
update-initramfs -u -k all
zfs set mountpoint=/ rpool/ROOT/pve-1
#exit the chroot
exit
Re-assign the mountpoint of the zfs and reboot
umount /mnt
umount rpool/ROOT/pve-1
zfs set mountpoint=/ rpool/ROOT/pve-1
Set the server to boot via hard drive and then Reboot (shutdown -r now)
If the system does not start, reboot into rescue linux and run the following to set the root path.
zfs set mountpoint=/ rpool/ROOT/pve-1


I don't know of a way to shrink a zfs partition (without a send/recreate/receive), so you better have room for your ext4 somewhere already.
  1. Create your ext partition
  2. Mount it somewhere temporarily
  3. rsync -avPX /boot/. /<tempboot>/.
  4. unmount /<tempboot>
  5. Move /boot to another location on zfs (eg. /bootbackup)
  6. Recreate /boot mountpoint and mount your new partition there
  7. Add the new boot ext4 partition to /etc/fstab
  8. Re-run update-grub (maybe even update-initramfs for good measure)
  9. Cross fingers and reboot
This is all from memory, so it's probably...right. The /bootbackup allows you to a location to periodically rsync your /boot ext4 into the pool for recovery purposes.

No comments:

Post a Comment