OPNsense Forum

Archive => 22.1 Legacy Series => Topic started by: nVIceman on June 22, 2022, 10:14:09 pm

Title: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: nVIceman on June 22, 2022, 10:14:09 pm
I'm trying to figure out if its default settings are fine for any installs I do, but I couldn't find anywhere what they are. Compared to the Auto ZFS install option through Other Modes, is it using those default settings or something else?

On a sidenote, is there any reason to not have both BIOS/UEFI set so you can boot using UEFI or Legacy mode? I've normally just chosen UEFI, but is there some drawback if also allowing the legacy boot even if you weren't or didn't plan to use it?
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 22, 2022, 10:25:36 pm
I'm trying to figure out if its default settings are fine for any installs I do, but I couldn't find anywhere what they are.
Settings with regard to what? There is nothing to tune in normal ZFS based installs. Just pick the number of disks, use a mirror if you can, that's it.

On a sidenote, is there any reason to not have both BIOS/UEFI set so you can boot using UEFI or Legacy mode? I've normally just chosen UEFI, but is there some drawback if also allowing the legacy boot even if you weren't or didn't plan to use it?
If you ever update your ZFS pool you need to update the boot loader, too. If you have only the boot method you actively use (UEFI) installed, you don't need to update the legacy boot loader. Because, you know, one day after an unexpected power outage and an empty CMOS battery, the system might decide to try legacy first, just because it's there.

I prefer to have options as an admin at install time but not give the system any options if you get what I mean.

HTH,
Patrick
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: nVIceman on June 22, 2022, 10:32:58 pm
Settings with regard to what? There is nothing to tune in normal ZFS based installs. Just pick the number of disks, use a mirror if you can, that's it.

Pool name, swap size, encryption, etc. When using hybrid mode, it's using settings defined by OPNsense team, but I wanted to know what those are.

If you ever update your ZFS pool you need to update the boot loader, too. If you have only the boot method you actively use (UEFI) installed, you don't need to update the legacy boot loader. Because, you know, one day after an unexpected power outage and an empty CMOS battery, the system might decide to try legacy first, just because it's there.

I prefer to have options as an admin at install time but not give the system any options if you get what I mean.

Yea, so something like this is what I meant, so sounds like I just want to manually configure the ZFS install through Other Modes like I've been doing as I noticed Legacy boot mode works. Thanks.
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 22, 2022, 11:23:24 pm
I'm probably confusing the OPNsense installer with the FreeBSD installer. The latter shows and lets you pick all of these parameters in "Auto ZFS" mode. Which is more "Guided ZFS" than automatic.

I'll have to fire up an OPNsense install in a VM and have a look at it again.

My remarks about legacy and UEFI boot stiil hold.
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: franco on June 23, 2022, 08:14:24 am
The defaults are almost the same as the FreeBSD installer subroutines only that you can't modify them:

https://github.com/opnsense/installer/blob/master/src/opnsense-zfs.sh#L40-L126

We have increased the swap size to 8 GB as 2 was too small for any type of modern deployment and negligible in size with modern drives (even 128 gb).


Cheers,
Franco
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Reiter der OPNsense on June 24, 2022, 12:52:07 pm
Hi Franco,
does this statement also apply to mini installations like APU2 boards with a 16 GB or 32 GB SSD?
https://forum.opnsense.org/index.php?topic=28059.msg136292#msg136292

Is there anything against using only a 2 GB swap partition in such a setting? Or what do you recommend for this case?
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: franco on June 24, 2022, 01:01:35 pm
Hmm, the swap dialog was hidden because it was decided to make auto-install as snappy as possible. seeing zfs being squeezed into tiny systems we might as well make the swap dialog get in the way of every zfs install, likely to the disadvantage of people avoiding the swap partition altogether.

While a swap file can be used, a swap file cannot hold a crash dump. This is what matters...


Cheers,
Franco
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 24, 2022, 01:21:17 pm
You can always install a stock FreeBSD in any layout you like and use the bootstrap method to install OPNsense.

Kind regards,
Patrick
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: franco on June 24, 2022, 01:36:20 pm
The "other installs" option are exactly the FreeBSD installs so you can avoid the bootstrap.

Except... FreeBSD doesn't install in hybrid mode. UEFI installs only work in UEFI and BIOS only works in BIOS environments. With our installs you can swap discs without these boundaries between hardware.

I know it's just a bonus, but I want to avoid later complaints. ;)


Cheers,
Franco
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 24, 2022, 01:54:28 pm
FreeBSD does offer BIOS and UEFI.
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: franco on June 24, 2022, 02:34:15 pm
I wasn't saying that.

Try installing BIOS and booting UEFI afterwards. Doesn't work. Try installing on UEFI and boot BIOS... doesn't work either. That's why we use hybrid approach. It's also better for testing. :)


Cheers,
Franco
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 24, 2022, 02:37:23 pm
FreeBSD supports installing legacy and UEFI simultaneously on the same boot drive. That's even the default.
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: franco on June 24, 2022, 02:45:46 pm
That's almost correct. The devil is in the details, however:

For ZFS it doesn't preselect this when booting BIOS:

https://github.com/opnsense/installer/commit/3bd93a6b36ca2

For UFS you can never get UEFI install for BIOS boot:

https://github.com/opnsense/src/commit/c10887be55

And I am relatively sure that UEFI UFS install won't boot BIOS due to incompatible layout or at least that was the case at some point. But covering all this in QA is tedious work so I could be mixing up cases from back in 21.7 / HBSD 12 and things are different now.


Cheers,
Franco
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Reiter der OPNsense on June 24, 2022, 03:37:44 pm
Hmm, the swap dialog was hidden because it was decided to make auto-install as snappy as possible. seeing zfs being squeezed into tiny systems we might as well make the swap dialog get in the way of every zfs install, likely to the disadvantage of people avoiding the swap partition altogether.

While a swap file can be used, a swap file cannot hold a crash dump. This is what matters...

I meant to have read that with ZFS generally no swap file can be used?

Anyway, from a technical point of view, is there anything against making the swap partition only 2 GB in size for a ZFS installation?
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Patrick M. Hausen on June 24, 2022, 03:52:38 pm
I meant to have read that with ZFS generally no swap file can be used?
No swap FILE ON ZFS.

A swap partition is of course perfectly ok.

A swap file can lead to a circular dependency leading to a lock-up. If the system is under very high memory pressure and needs to free some blocks to do the necessary bookkeeping to write to ZFS, while trying to push blocks to swap which needs to be written to ZFS ... see the problem?

A swap partition is not a filesystem.
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: Reiter der OPNsense on June 24, 2022, 07:13:17 pm
Exactly, that's what I mean. Franco was talking about a swap file, but I don't think I quite understand what he means.

But anyway, what I would be very interested in is if there is a recommendation for a minimum size for the swap partition in a ZFS installation. Or in other words, are my 2 GB too small? Should I expect problems?
Title: Re: Auto ZFS GPT/UEFI Hybrid Install (what settings does it use?)
Post by: nVIceman on June 24, 2022, 09:22:10 pm
Thanks to the replies. I am a little confused about swap file vs partition. If installing ZFS (not Hybrid) where it says "Swap Size", is that for a swap file or partition?

I was going to make Swap Size 8GB instead of 2GB, make scheme GPT (UEFI) instead of GPT (BIOS+UEFI). Those are the only 2 planned changes. Is there some better options I should choose? I typically use a 60GB SSD.

Also, I use either 4GB or 8GB RAM of that makes a difference.