So solution is simple: it is
second USB Flash Drive
Which will be good ol` MBR-type, ext4-filesystem and contain /boot directory. This way it will work. It is applies to USB HDDs well.
And for PVE it is all the same.
===
So basically i follow this awesome guide:
https://qlr.ro/fix-proxmox-zfs-boot-issues-grub-device-not-found/
I will past it here (in case if link will be down)
Things you’ll need:
- proxmox server that refuses to boot
- temporary USB stick (to boot sysresccd from)
- permanent USB stick (or other block device – I was using an SD card) where the new boot partition will live
sysresccd
It is a pretty nifty tool, but what makes it even more nifty is that zfsonlinux.org provides one that has ZFS support built in. Download it from
here and “burn” it to the temporary USB stick (I was using
rufus). Plug it in your server and boot from it.
zfs mount
Proxmox always names it’s (first) zfs pool
rpool so let us import that:
go to
/mnt:
make a new directory to mount your old system to, in this case
proxmox:
set the mount point to the path we just created above:
1 | zfs set mountpoint=/mnt/proxmox rpool/ROOT/pve-1 |
mount it:
1 | zfs mount rpool/ROOT/pve-1 |
we also need to mount couple of other things:
1
2
3 | mount -t proc /proc /mnt/proxmox/proc
mount --rbind /dev /mnt/proxmox/dev
mount --rbind /sys /mnt/proxmox/sys |
chroot into proxmox
1
2 | chroot /mnt/proxmox /bin/bash
source /etc/profile |
make new partition
find out what block device you wanna
sacrifice:
double check if its the right one (in my case it was
sdh):
Create a partition on it:
while in fdisk use these commands to create a new primary partition:
1
2
3
4
5
6
7 | o (MBR partition table)
n (new partition)
p (primary partition)
1 (partition number: 1)
just press enter (leave default for first cylinder)
just press enter (leave default for last cylinder)
w (write changes to disk) |
Notes:
- GPT would also work, but im using a 8GB sd card here… mbr is old, but not dead
- by default fdisk will always make a partition of type “Linux”, no need to play around with that
Format the newly created partition to ext4:
we need to modify our
/etc/fstab and add our not-yet-created
/boot partition, to do that we gonna add it by it’s UUID run the following:
and find your partitions (in my case sdh1) UUID. Once thats written down on paper open fstab for editing:
Add a new
TEMPORARY entry according to the UUID you got earlier, something similar to:
1 | UUID=afdc2cf9-c06e-452a-8e42-2b25ad9dac55 /media ext4 defaults 0 0 |
Test it out my trying to mount it:
mount /media
move /boot
Copy your old boot to the newly mounted media and unmount it:
1
2
3 | cp -Rpvf /boot/* /media/
sync
umount /media |
edit your previously made temporary fstab entry so that it will be mount as /boot:
1 | UUID=afdc2cf9-c06e-452a-8e42-2b25ad9dac55 /boot ext4 defaults 0 0 |
mount it for real now:
run the following (note it is
sdh not
shd1):
1
2
3
4 | update-grub
grub-install --recheck /dev/sdh
sync
umount /boot |
Now you can remove the
old /boot:
and finally exit the chroot enviroment:
zfs umount
umount proc:
1 | umount /mnt/proxmox/proc |
umount sys:
If it gives you lip, you probably need to unmount something else first, find out what by running:
1 | mount | grep /mnt/proxmox/sys |
umount dev (same procedure as with sys):
umount zfs:
set the mount-point back to where it should be:
1 | zfs set mountpoint=/ rpool/ROOT/pve-1 |
Reboot, change the boot device in the bios, and if all goes well it should work!