Difference between revisions of "Booting a ZFS root file system via UEFI"

From Proxmox VE
Jump to navigation Jump to search
m (better link formatting)
(PVE >= 6 supports ZFS root file systems on UEFI.)
Tag: Replaced
 
Line 1: Line 1:
If you need to boot a ZFS root filesystem you already have on a new system which only supports UEFI, you cannot do this out-of-the-box. Unfortunately, there is current no capability to do this in ZFS on Linux, so Proxmox VE is unfortunately also not able to do this (Also mentioned in the article about [[ZFS_on_Linux|ZFS on Linux]]). However, you can do this by using a UEFI boot stick with rEFInd, and manually sync it.
+
Proxmox VE 6 supports ZFS root file systems on UEFI. See Proxmox VE reference documentation about [https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_installation_as_root_file_system ZFS root file systems] and [https://pve.proxmox.com/pve-docs/pve-admin-guide.html#sysboot host bootloaders].
 
You can use whatever medium you like:
 
* another internal (bootable) disk
 
* USB flash drive
 
* network
 
* optical disk
 
 
 
for simplicity, this article is about an USB flash drive.
 
 
 
= WARNING =
 
This is not recommended, especially not in a production environment, where you create a single point of failure.
 
Please be aware that you should only consider using this setup if you know what you're doing and are familiar with the Linux command line, its system tools and program, and do it on your own risk. If you use the wrong device, you '''could nuke your whole system''', so consider yourself warned.
 
 
 
= Software Introduction =
 
 
 
The [http://www.rodsbooks.com/refind/ rEFInd Boot Manager] by Roderick W. Smith is an UEFI boot manager, which is able to boot a lot of different operating systems including Linux and therefore Proxmox VE. Its setup and configuration is very easy.
 
 
 
= Preparting for rEFInd =
 
 
 
Not all programs used in this article are already preinstalled in your Proxmox VE environment, so please install them first:
 
 
 
<pre>
 
apt install lsscsi wget fdisk unzip parted
 
</pre>
 
 
 
== Using an USB flash drive ==
 
 
 
Double check, that you're using the correct drive, this article will assume the drive is available in <code>/dev/sdi</code>. The minimum requirement for a thumb drive is 128 MB (note the ''M'', so any drive from the last 10 years should be sufficient).
 
 
 
<pre>
 
root@proxmox ~ > lsscsi --size | grep sdi
 
[7:0:0:0]    disk    JetFlash Transcend 32GB  1.00  /dev/sdi  31.6GB
 
</pre>
 
 
 
Let's create the partition layout (for simplicity, only one partition)
 
 
 
<pre>
 
root@proxmox ~ > parted -s /dev/sdi -- mktable gpt
 
root@proxmox ~ > parted -s /dev/sdi -- mkpart UEFI fat32 1 -1
 
root@proxmox ~ > parted -s /dev/sdi -- print
 
Model: JetFlash Transcend 32GB (scsi)
 
Disk /dev/sdi: 31,6GB
 
Sector size (logical/physical): 512B/512B
 
Partition Table: gpt
 
Disk Flags:
 
 
 
Number  Start  End    Size    File system  Name  Flags
 
1      1049kB  31,6GB  31,6GB              UEFI  msftdata
 
</pre>
 
 
 
and filesystem
 
 
 
<pre>
 
root@proxmox ~ > mkfs.vfat -F32 /dev/sdi1
 
mkfs.fat 4.1 (2017-01-24)
 
</pre>
 
 
 
The setup is similar to an internal disk setup, but I'd create a smaller partition.
 
 
 
= Setting up rEFInd for Proxmox VE =
 
 
 
== Installing rEFInd ==
 
 
 
This article describes the manual install method according to [http://www.rodsbooks.com/refind/installing.html#linux the official documentation].
 
 
 
After mounting our newly created UEFI boot disk from the previous step:
 
<pre>
 
root@proxmox ~ > mount /dev/sdi1  /mnt
 
</pre>
 
we download the binary distribution from the [http://www.rodsbooks.com/refind/getting.html Getting rEFInd] page directly onto our flash drive (please always get the download link from the aforementioned webpage to use the most recent version of rEFInd):
 
<pre>
 
root@proxmox /mnt > wget -q -O refind-bin-0.11.3.zip http://sourceforge.net/projects/refind/files/0.11.3/refind-bin-0.11.3.zip/download
 
root@proxmox /mnt > ls -l refind-bin-0.11.3.zip
 
-rwxr-xr-x 1 root root 3702691 Jul 22 23:43 refind-bin-0.11.3.zip
 
</pre>
 
and extract it
 
<pre>
 
root@proxmox /mnt > unzip -q refind-bin-0.11.3.zip
 
root@proxmox /mnt > ls -l
 
total 3632
 
drwxr-xr-x 7 root root  16384 Jul 22 23:08 refind-bin-0.11.3
 
-rwxr-xr-x 1 root root 3702691 Jul 22 23:43 refind-bin-0.11.3.zip
 
</pre>
 
now install the binary distribution of rEFInd - which is a simple copy job
 
<pre>
 
root@proxmox /mnt > mkdir -p efi/boot
 
root@proxmox /mnt > cp -r refind-bin-0.11.3/refind/{drivers_x64,icons,tools_x64} efi/boot/
 
root@proxmox /mnt > cp refind-bin-0.11.3/refind/refind_x64.efi efi/boot/bootx64.efi
 
</pre>
 
Afterwards, you already have a working UEFI bootloader. It uses its defaults settings and scans for all available boot options and present them graphically.
 
You can remove the install files, but it's not that big and you can keep it for further reference.
 
 
 
== Configuring rEFInd for Proxmox VE ==
 
 
 
In this simple example, it boots only the preconfigured Proxmox VE kernel and the current system. In a more advanced setup, you can do whatever you want - but it is out of the scope of this article.
 
 
 
First, we copy the current (at the time of writing <code>4.15.18-5-pve</code>) kernel to the efi device and list the important files:
 
<pre>
 
root@proxmox /mnt > cp /boot/{initrd.img,vmlinuz}-4.15.18-5-pve .
 
 
 
root@proxmox /mnt > l
 
total 59296
 
drwxr-xr-x 3 root root    16384 Sep 30 09:28 efi
 
-rwxr-xr-x 1 root root 48528392 Sep 30 09:45 initrd.img-4.15.18-5-pve
 
-rwxr-xr-x 1 root root  8443760 Sep 30 09:45 vmlinuz-4.15.18-5-pve
 
</pre>
 
 
 
Now create a configuration file in <code>efi/boot/refind.conf</code> with the following content:
 
 
 
<pre>
 
timeout 20
 
icons_dir EFI/boot/icons/
 
scanfor manual
 
scan_all_linux_kernels false
 
 
 
menuentry "Proxmox VE" {
 
    ostype Linux
 
    graphics on
 
    loader /vmlinuz-4.15.18-5-pve
 
    initrd /initrd.img-4.15.18-5-pve
 
    options "ro root=ZFS=rpool/ROOT/pve-1 quiet nomodeset"
 
}
 
</pre>
 
 
 
Unmount the pen drive:
 
<pre>
 
root@proxmox ~ > umount /mnt
 
</pre>
 
 
 
You should now have a working UEFI boot stick which boots directly to your default Proxmox VE ZFS <code>rpool</code>.
 
 
 
== Eye Candy ==
 
 
 
If you also want to use a nice icon for your private setup, just search on google image search for a nice looking Proxmox VE logo or create one yourself and put it with transparent background in a PNG file. A good starting point is also the PVE Wiki logo.
 
 
 
You can should put the file into your root directory and the settings like this:
 
 
 
<pre>
 
root@proxmox /mnt > l
 
total 59312
 
drwxr-xr-x 3 root root    16384 Sep 30 09:28 efi
 
-rwxr-xr-x 1 root root 48528392 Sep 30 09:45 initrd.img-4.15.18-5-pve
 
-rwxr-xr-x 1 root root    5382 Sep 30 10:11 proxmox.png
 
-rwxr-xr-x 1 root root  8443760 Sep 30 09:45 vmlinuz-4.15.18-5-pve
 
 
 
root@proxmox /mnt > cat efi/boot/refind.conf
 
timeout 20
 
icons_dir EFI/boot/icons/
 
scanfor manual
 
scan_all_linux_kernels false
 
 
 
menuentry "Proxmox VE" {
 
    icon /proxmox.png
 
    ostype Linux
 
    graphics on
 
    loader /vmlinuz-4.15.18-5-pve
 
    initrd /initrd.img-4.15.18-5-pve
 
    options "ro root=ZFS=rpool/ROOT/pve-1 quiet nomodeset"
 
}
 
</pre>
 
 
 
Afterwards, you end up with this screen (the little pen drive logo on the right bottom implies, that this entry will be booted from USB):
 
 
 
[[Image:REFInd_boot_screen_proxmox.png|center]]
 
 
 
== Update ==
 
 
 
Unfortunately, you have to update your settings, kernel and initrd manually in order to boot newer updates, but as it is said in the beginning, this is totally unofficial and not for production use.
 
 
 
Normally, these steps are required:
 
* coping <code>vmlinuz</code> and <code>initrd.img</code> files corresponding to the current version to your UEFI disk
 
* adding a new section or changing the current one (better to add a new entry in order to be able to revert to the old kernel in case of error or misconfiguration)
 
* reboot
 
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Latest revision as of 09:11, 9 June 2020

Proxmox VE 6 supports ZFS root file systems on UEFI. See Proxmox VE reference documentation about ZFS root file systems and host bootloaders.