Re: Set ZFS pool ashift=14 for FreeBSD root pools?
vermaden <[email protected]> Tue, 12 May 2026 23:01:08 +0200
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <oajprzmcwkidwhyhbnpe@dwkj> |
>> This has to be done before ZFS pool
>> creation and it can be set like that:
>>
>> # sysctl vfs.zfs.min_auto_ashift=14
> How can I do this at install time for all root pools?
>
> Lionel
Something like that:
1. Boot with FreeBSD-15.0-RELEASE-amd64-disc1.iso ISO.
2. Select [Live CD] option.
3. Login as 'root' and hit [ENTER] on password question.
4. Get network connection (LAN or WiFi).
5. Set needed ASHIFT.
# sysctl vfs.zfs.vdev.min_auto_ashift=14
6. Download verimg(8) tool.
# fetch https://raw.githubusercontent.com/vermaden/verimg/refs/heads/master/verimg
7. Use gpart(8)/zpool(8)/zfs(8) tools to create your partitions.
# grep '^[^#]' misc/git.verimg/verimg | grep -v __m | grep -e 'zpool create' -e 'zfs create' -e 'gpart ' -e 'zpool import'
gpart create -s GPT ${DEVICE}
gpart add -a 4k -s 512K -t freebsd-boot -l gptboot0 ${DEVICE}
gpart add -a 4k -s 40M -t efi -l efiboot0 ${DEVICE}
gpart add -a 4k -s 1G -t freebsd-swap -l swap0 ${DEVICE}
gpart add -a 4k -s 8G -t freebsd-zfs -l zfs0 ${DEVICE}
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${DEVICE}
if ! zpool create -R "${ARG_MNTD}" -O compress=lz4 -O atime=off -m none -f ${ARG_POOL} "${DEVICE}p4" 2> /dev/null
zfs create -o mountpoint=none ${ARG_POOL}/ROOT
zfs create -o mountpoint=/ ${ARG_POOL}/ROOT/default
zfs create -o mountpoint=/home ${ARG_POOL}/home
zfs create -o mountpoint=/tmp -o exec=on -o setuid=off ${ARG_POOL}/tmp
zfs create -o mountpoint=/usr -o canmount=off ${ARG_POOL}/usr
zfs create -o setuid=off ${ARG_POOL}/usr/ports
zfs create ${ARG_POOL}/usr/src
zfs create -o mountpoint=/var -o canmount=off ${ARG_POOL}/var
zfs create -o exec=off -o setuid=off ${ARG_POOL}/var/audit
zfs create -o exec=off -o setuid=off ${ARG_POOL}/var/crash
zfs create -o exec=off -o setuid=off ${ARG_POOL}/var/log
zfs create -o atime=on ${ARG_POOL}/var/mail
zfs create -o setuid=off ${ARG_POOL}/var/tmp
8. As ZFS pool will be mounted at /mnt use verimg(8) to install FreeBSD like that:
# sh verimg -M setup -t mnt -R /usr/freebsd-packages/offline
INFO: options that will be used
ARG_MODE: setup
ARG_TYPE: mnt
ARG_FILE: -
ARG_SIZE: -
ARG_VERS: releng/15.0
ARG_INST: beadm:lsblk
ARG_MNTD: /mnt
ARG_SRCD: /usr/src
ARG_KERN: GENERIC
ARG_POOL: sys
ARG_REPO: /usr/freebsd-packages/offline
ARG_BRCH: latest
9. You should have FreeBSD installed.
Regards,
vermaden