Bug 208802 - Install to zfs should have copies= option to provide some anti-bitrot protection
Summary: Install to zfs should have copies= option to provide some anti-bitrot protection
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-sysinstall (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-14 14:01 UTC by MMacD
Modified: 2026-01-21 14:46 UTC (History)
7 users (show)

See Also:


Attachments
Screenshot: bsdinstall, ZFS configuration, pool options (27.10 KB, image/png)
2025-10-04 20:30 UTC, devnull
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description MMacD 2016-04-14 14:01:55 UTC
Building up a filesever with a zfs 3-way mirror for the sake of the anti-bitrot scrubbing, I wanted to install onto zfs as well, using copies=2 (or even =3) as a compromise between having no bitrot protection and consuming a second drive as a mirror.  But there is no install option to do copies=.

I decided to hack the install file myself, but then couldn't squeeze everything back into the same size iso it started with.  I've never done release engineering, and don't have time to spend debugging things like that, so why it wouldn't cooperate remains a mystery to me and I ended up installing to ufs as my only practical option.
Comment 1 Shawn Webb 2016-04-14 15:05:22 UTC
Instead of prompting for the copies attribute, zfsinstall could have generic "set these zpool options" and "set these zfs options for the top-level dataset" prompts. You'd specify your own options that would get added as -oname=value arguments to `zpool create [Pool]` in the case of the former prompt and `zfs set [TopLevelDatasetOfPool]` in the case of the latter.

But I'm not too sure I like that idea, either. Either way, it's just an idea to throw around.
Comment 2 MMacD 2016-04-15 14:22:21 UTC
(In reply to Shawn Webb from comment #1)
That'd be okay with me, probably even better than my idea if the installer sanity-checked the options chosen and complained if there was some craziness.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2016-04-18 00:45:46 UTC
Affects installer.
Comment 4 Bob Bishop 2017-05-04 12:17:39 UTC
A quick hack to work around this is:

Start the installer, select Shell (not Install).
Fire up csh and start bsdinstall from that.
Proceed with the installation as normal, but...
...when the installer starts checking the distfiles, hit ^Z
Now you can run `zfs set copies=2 zroot' or whatever.
Then `fg' to resume bsdinstall and complete the installation.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2025-01-20 05:34:33 UTC
Reassign.
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-09-30 02:57:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=494de51bc0074472d1b01604f085daea0844f240

commit 494de51bc0074472d1b01604f085daea0844f240
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-09-30 02:46:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-09-30 02:55:46 +0000

    bsdinstall: Add loader.efi to all ESPs we create

    For proper redundancy, add copies of loader.efi to each of the ESPs we
    create when we create multi-volume ZFS datasets. zfsboot creates a list
    of secondary ESPs, while bootpart doesn't create any (it's the UFS
    partitioning tool) because we don't supporg UFS over gmirror. The
    primary ESP is mounted and is what we use efibootmgr to boot from. The
    redundant copies allow the system to boot if the primary disks fails.

    Sponsored by:           Netflix
    MFC After:              2 days
    PR:                     208802
    Reviewed by:            cperciva
    Differential Revision:  https://reviews.freebsd.org/D52780

 usr.sbin/bsdinstall/scripts/auto       |  3 ++
 usr.sbin/bsdinstall/scripts/bootconfig | 61 ++++++++++++++++++++++------------
 usr.sbin/bsdinstall/scripts/zfsboot    | 28 +++++++++-------
 3 files changed, 59 insertions(+), 33 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-10-04 00:29:04 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b734c47744611d1d2bd61d15045b7903d4c35be

commit 4b734c47744611d1d2bd61d15045b7903d4c35be
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-09-30 02:46:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-10-04 00:27:07 +0000

    bsdinstall: Add loader.efi to all ESPs we create

    For proper redundancy, add copies of loader.efi to each of the ESPs we
    create when we create multi-volume ZFS datasets. zfsboot creates a list
    of secondary ESPs, while bootpart doesn't create any (it's the UFS
    partitioning tool) because we don't supporg UFS over gmirror. The
    primary ESP is mounted and is what we use efibootmgr to boot from. The
    redundant copies allow the system to boot if the primary disks fails.

    Sponsored by:           Netflix
    MFC After:              2 days
    PR:                     208802
    Reviewed by:            cperciva
    Differential Revision:  https://reviews.freebsd.org/D52780

    (cherry picked from commit 494de51bc0074472d1b01604f085daea0844f240)

 usr.sbin/bsdinstall/scripts/auto       |  3 ++
 usr.sbin/bsdinstall/scripts/bootconfig | 61 ++++++++++++++++++++++------------
 usr.sbin/bsdinstall/scripts/zfsboot    | 28 +++++++++-------
 3 files changed, 59 insertions(+), 33 deletions(-)
Comment 8 devnull freebsd_committer freebsd_triage 2025-10-04 20:30:26 UTC
Created attachment 264289 [details]
Screenshot: bsdinstall, ZFS configuration, pool options

(In reply to Shawn Webb from comment #1)

If I understand correctly, this is implemented as shown in the screenshot.
Comment 9 devnull freebsd_committer freebsd_triage 2025-10-04 20:36:49 UTC
(In reply to commit-hook from comment #6)

Also, maybe bug 258987 and bug 262770
Comment 10 commit-hook freebsd_committer freebsd_triage 2025-10-04 23:19:43 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8e73f45fc5fe736ad398d15f547af593cc84e6f

commit d8e73f45fc5fe736ad398d15f547af593cc84e6f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-09-30 02:46:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-10-04 23:17:36 +0000

    bsdinstall: Add loader.efi to all ESPs we create

    For proper redundancy, add copies of loader.efi to each of the ESPs we
    create when we create multi-volume ZFS datasets. zfsboot creates a list
    of secondary ESPs, while bootpart doesn't create any (it's the UFS
    partitioning tool) because we don't supporg UFS over gmirror. The
    primary ESP is mounted and is what we use efibootmgr to boot from. The
    redundant copies allow the system to boot if the primary disks fails.

    Sponsored by:           Netflix
    MFC After:              2 days
    PR:                     208802
    Reviewed by:            cperciva
    Differential Revision:  https://reviews.freebsd.org/D52780

    (cherry picked from commit 494de51bc0074472d1b01604f085daea0844f240)

 usr.sbin/bsdinstall/scripts/auto       |  3 ++
 usr.sbin/bsdinstall/scripts/bootconfig | 61 ++++++++++++++++++++++------------
 usr.sbin/bsdinstall/scripts/zfsboot    | 28 +++++++++-------
 3 files changed, 59 insertions(+), 33 deletions(-)
Comment 11 Warner Losh freebsd_committer freebsd_triage 2025-10-04 23:26:30 UTC
*** Bug 258987 has been marked as a duplicate of this bug. ***
Comment 12 Warner Losh freebsd_committer freebsd_triage 2025-10-04 23:27:15 UTC
*** Bug 262770 has been marked as a duplicate of this bug. ***
Comment 13 Warner Losh freebsd_committer freebsd_triage 2025-10-04 23:29:29 UTC
Fixed in head, stable/14 and stable/15 so the next releases from those branches will get this.

But I seem to have tagged the wrong bug in my commit.
Comment 14 Warner Losh freebsd_committer freebsd_triage 2026-01-21 14:46:37 UTC
Oh! Not fixed at all... I tagged the wrong bug in the commits I made.