Cant't you use
proxmox-boot-tool for that?
If you have an
emtpy patition on your USB-Stick it should be just a matter of something
like:
Code:
proxmox-boot-tool format /dev/disk/by-id/usb-stick-partX
proxmox-boot-tool init /dev/disk/by-id/usb-stick-partX
# or for GRUB
# proxmox-boot-tool init /dev/disk/by-id/usb-stick-partX grub
proxmox-boot-tool refresh
# not sure if below is needed - might work without
update-initramfs -u -k all
I've used similar commands to (re-)recreate boot partitions on so many internal disks, nvmes and usb-devices without any issues.
The partition layout can easily be done using
parted (mklabel, mkpart),
sgdisk and
wipefs.
Hey, thanks for your reply! After doing a lot of research, this thread definitely pointed me in the right direction. I later found this discussion:
Move Boot Partition ZFS USB, where the original author of the linked post provides a perfect roadmap for the scenario I was facing.
In the hope that this will help someone else at some point, I am paraphrasing his solution here:
From the orginal thread: "Move boot partition ZFS USB"
[...] "For anyone wanting to replicate this is the process:
(Assuming an unbootable proxmox 8 install due to raid card & proxmox 8 live iso)
- Delete all existing partitions on your usb or any other device that can boot and is unaffected by raid card. (at least 1 GB space, depending on number of kernels installed)
- To replicate the setup above and have the first sector start at 34, start with gdisk /dev/sdX, press "x" for expert mode, "l" for alignment and set it to 1, press "m" to return back to normal mode
- "n" to create new partition with number 1 (sdX1), first sector: 34, last sector: 2047, Hex: EF02
- "n" to create new partition with number 2 (sdX2), first sector: 2048, last sector: 1050623, Hex: EF00 (might want to increase last sector number if planning on having more kernels)
- "w" to write changes and exit
- Now mount rpool to /mnt with zpool import rpool -R /mnt
- And mount /proc /sys /dev /run with:
Bash:
<span>mount</span> -t proc proc /mnt/proc<br><span>mount</span> -t sysfs sys /mnt/sys<br><span>mount</span> -o <span>bind</span> /dev /mnt/dev<br><span>mount</span> -o <span>bind</span> /run /mnt/run
- chroot /mnt
- proxmox-boot-tool format /dev/sdX2 --force and proxmox-boot-tool init /dev/sdX2
- Now check if the UUID of /dev/sdX2 from blkid /dev/sdX2 is inside /etc/kernel/proxmox-boot-uuids, if not try to run proxmox-boot-tool refresh
- To unmount the system folders we need to run umount for each /mnt/proc /mnt/sys /mnt/dev /mnt/run
- zpool export rpool, try -f to force the export
- Important is to export the zfs pool, because proxmox doesn't boot with force flag on pool import during boot" – @whytf, Dec 20, 2023
I may add:
There are certainly other ways to do this, but for me, the most convenient approach was to work with three USB drives and one or two NVMe drives.
- USB1: Proxmox ISO
- USB2: Used for the first Proxmox installation (as a live environment). This has a nice shell application in the GUI, which is helpful if your keyboard mapping is messed up. 'Copy & paste' works like a charm here.
- USB3: The BOOT drive to be.
- NVMe: Final Proxmox installation with ZFS. (I mirrored the root system across two drives, but you can also use a single NVMe with ZFS.)
For me, it made perfect sense to have the installation setup on the USB and the NVMe drive identical—same IP address, etc.—except for ZFS! I would recommend keeping the Proxmox USB installation on a simple drive without ZFS to avoid conflicting ZFS 'rpools'.
Good luck to anyone trying to achieve this!