Annotation of wikisrc/zfs.mdwn, revision 1.27

1.1       gdt         1: # ZFS on NetBSD
                      2: 
1.11      gdt         3: This page attempts to do two things: provide enough orientation and
1.13      wiz         4: pointers to standard ZFS documentation for NetBSD users who are new to
1.11      gdt         5: ZFS, and to describe NetBSD-specific ZFS information.  It is
1.1       gdt         6: emphatically not a tutorial or an introduction to ZFS.
                      7: 
                      8: Many things are marked with \todo because they need a better
                      9: explanation, and some have question marks, indicating that the
                     10: statement needs verification.
                     11: 
                     12: # Documentation Pointers
                     13: 
                     14: See the man pages for zfs(8) and zpool(8).
                     15: 
1.27    ! gdt        16:   - [OpenZFS Documentation](https://openzfs.github.io/openzfs-docs/)
        !            17:   - [OpenZFS admin docs index page](https://github.com/openzfs/zfs/wiki/Admin-Documentation)
        !            18:   - [FreeBSD Handbook ZFS Chapter](https://www.freebsd.org/doc/handbook/zfs.html)
1.4       gdt        19:   - [Oracle ZFS Administration Manual](https://docs.oracle.com/cd/E26505_01/html/E37384/index.html)
1.24      gdt        20:   - [Wikipedia](https://en.wikipedia.org/wiki/ZFS)
1.21      gdt        21: 
1.1       gdt        22: # Status of ZFS in NetBSD
                     23: 
1.27    ! gdt        24: ## NetBSD 8
1.23      gdt        25: 
1.27    ! gdt        26: NetBSD 8 has an old version of ZFS, and it is not recommended for use
        !            27: at all.  There is no evidence that anyone is interested in helping
        !            28: with ZFS on 8.  Those wishing to use ZFS on NetBSD 8 should therefore
        !            29: update to NetBSD 9.
1.1       gdt        30: 
                     31: ## NetBSD 9
                     32: 
1.27    ! gdt        33: NetBSD-9 has ZFS that is considered to work well.  There have been
        !            34: fixes since 9.0_RELEASE.  As always, people running NetBSD 9 are
        !            35: likely best served by the most recent version of the netbsd-9 stable
        !            36: branch.  As of 2021-02, ZFS in the NetBSD 9.1 release is very close to
        !            37: netbsd-9.
1.1       gdt        38: 
1.27    ! gdt        39: ## NetBSD-current
1.1       gdt        40: 
1.27    ! gdt        41: NetBSD-current (as of 2021-02) has similar ZFS code to 9.
1.5       gdt        42: 
1.9       gdt        43: There is initial support for [[ZFS root|wiki/RootOnZFS]], via booting from
1.5       gdt        44: ffs and pivoting.
1.1       gdt        45: 
1.27    ! gdt        46: ## NetBSD/xen special issues
1.1       gdt        47: 
1.27    ! gdt        48: In NetBSD-9, MAXPHYS is 64KB in most places, but because of xbd(4) it
        !            49: is set to 32KB for XEN kernels.  Thus the standard zfs kernel modules
        !            50: do not work under xen.  In NetBSD-current, xbd(4) supports 64 KB
        !            51: MAXPHYS and this is no longer an issue.
1.1       gdt        52: 
1.27    ! gdt        53: Xen and zfs on current are reported to work well together, as of 2021-02.
1.1       gdt        54: 
                     55: ## Architectures
                     56: 
                     57: Most people seem to be using amd64.
                     58: 
                     59: To build zfs, one puts MKZFS=yes in mk.conf.  This is default on amd64
                     60: and aarch64 on netbsd-9.  In current, it is also default on sparc64.
                     61: 
                     62: More or less, zfs can be enabled on an architecture when it is known
                     63: to build and run reliably.  (Of course, users are welcome to build it
                     64: and report.)
                     65: 
1.27    ! gdt        66: # Quick Start
        !            67: 
        !            68: See the [FreeBSD Quickstart
        !            69: Guide](https://www.freebsd.org/doc/handbook/zfs-quickstart.html); only
        !            70: the first item is NetBSD specific.
        !            71: 
        !            72:   - Put zfs=YES in rc.conf.
        !            73: 
        !            74:   - Create a pool as "zpool create pool1 /dev/dk0".
        !            75: 
        !            76:   - df and see /pool1
        !            77: 
        !            78:   - Create a filesystem mounted on /n0 as "zfs create -o
        !            79:     mountpoint=/n0 pool1/n0".
        !            80: 
        !            81:   - Go back and read the documentation and start over.
        !            82: 
1.1       gdt        83: # NetBSD-specific information
                     84: 
                     85: ## rc.conf
                     86: 
                     87: The main configuration is to put zfs=YES in rc.conf, so that the rc.d
1.13      wiz        88: scripts bring up ZFS and mount ZFS file systems.
1.1       gdt        89: 
1.14      gdt        90: ## pool locations
                     91: 
                     92: One can add disks or parts of disks into pools.  Methods of specifying
                     93: areas to be included include:
                     94: 
1.27    ! gdt        95:   - entire disks (e.g., /dev/wd0d on amd64)
1.14      gdt        96:   - disklabel partitions (e.g., /dev/sd0e)
                     97:   - wedges (e.g., /dev/dk0)
                     98: 
1.1       gdt        99: ## mount order
                    100: 
1.13      wiz       101: NetBSD 9 mounts other file systems and then ZFS file systems.  This can
1.3       gdt       102: be a problem if /usr/pkgsrc is on ZFS and /usr/pkgsrc/distfiles is on
                    103: NFS.  A workaround is to use noauto and do the mounts in
                    104: /etc/rc.local.
                    105: 
1.27    ! gdt       106: NetBSD current after 20200301 mounts ZFS first.  The same issues and
        !           107: workarounds apply in different circumstances.
1.1       gdt       108: 
1.19      gdt       109: ## NFS
                    110: 
1.27    ! gdt       111: zfs filesystems are reported to be exportable over NFS.
        !           112: 
        !           113: The "zfs share" command adds a line to /etc/zfs/exports, and "zfs
        !           114: unshare" removes it.
1.19      gdt       115: 
1.27    ! gdt       116: \todo Explain how /etc/zfs/exports is used.
1.19      gdt       117: 
1.20      gdt       118: This is reported to work on 9.0 STABLE, but to cause a panic on
1.25      gdt       119: current (20200302).  See [misc/55042](http://gnats.netbsd.org/55042).
1.20      gdt       120: 
1.14      gdt       121: ## zvol
                    122: 
                    123: Within a ZFS pool, the standard approach is to have file systems, but
                    124: one can also create a zvol, which is a block device of a certain size.
                    125: 
                    126: \todo The zvol will appear as /dev/???? and can be used in many
                    127: respects like a slice.  However, the system will not read disklabels
                    128: and gpt labels from a zvol; in this respect it is more like a disklabel
                    129: partition or wedge than a disk drive.
                    130: 
                    131: \todo Explain that one can export a zvol via iscsi.
                    132: 
                    133: \todo Explain if one can swap on a zvol.
                    134: 
                    135: \todo Explain that one can use ccd to create a normal-looking disk
                    136: from a zvol.  This allows reading a GPT label from the zvol, which is
                    137: useful in case the zvol had been exported via iscsi and some other
                    138: system created a label.
                    139: 
1.1       gdt       140: # Memory usage
                    141: 
                    142: Basically, ZFS uses lots of memory and most people run it on systems
                    143: with large amounts of memory.  NetBSD works well on systems with
                    144: comparatively small amounts of memory.  So a natural question is how
1.27    ! gdt       145: well ZFS works on one's VAX with 2M of RAM :-) More seriously, one
        !           146: might ask if it is reasonable to run ZFS on a RPI3 with 1G of RAM, or
        !           147: if it is reasonable on a system with 4G.
        !           148: 
        !           149: The prevailing wisdom is more or less that ZFS consumes 1G plus 1G per
        !           150: 1T of disk.  32-bit architectures are viewed as too small to run ZFS.
        !           151: 
        !           152: Besides RAM, zfs requires that architecture kernel stack size is at
        !           153: least 12KB or more -- some operations cause stack overflow with 8KB
        !           154: kernel stack. On NetBSD, the architectures with 16KB kernel stack are
        !           155: amd64, sparc64, powerpc, and experimental ia64, hppa. mac68k and sh3
        !           156: have 12KB kernel stack. All others use only 8KB stack, which is not
        !           157: enough to run zfs.
        !           158: 
        !           159: NetBSD has many statistics provided via sysctl; see "sysctl
        !           160: kstat.zfs".
        !           161: 
        !           162: FreeBSD has tunables that NetBSD does not seem to have, described in
        !           163: [FreeBSD Handbook ZFS Advanced
        !           164: section](https://docs.freebsd.org/en/books/handbook/zfs/#zfs-advanced).
1.1       gdt       165: 
1.27    ! gdt       166: # Interoperability with other systems
1.1       gdt       167: 
1.27    ! gdt       168: Modern ZFS uses pool version 5000 and feature flags.
1.1       gdt       169: 
1.27    ! gdt       170: It is in general possible to export a pool and them import the pool on
        !           171: some other system, as long as the other system supports all the used
        !           172: features.
1.10      gdt       173: 
1.27    ! gdt       174: \todo Explain how to do this and what is known to work.
1.26      wiki      175: 
1.27    ! gdt       176: \todo Explain feature flags relationship to FreeBSD, Linux, iIllumos,
        !           177: macOS.
1.1       gdt       178: 
1.27    ! gdt       179: # Sources of ZFS code
1.2       gdt       180: 
1.27    ! gdt       181: Currently, there are multiple ZFS projects and codebases:
1.1       gdt       182: 
1.27    ! gdt       183:   - [OpenZFS](http://www.open-zfs.org/wiki/Main_Page)
        !           184:   - [openzfs repository](https://github.com/openzfs/zfs}
        !           185:   - [zfsonlinux](https://zfsonlinux.org/)
        !           186:   - [OpenZFS on OS X ](https://openzfsonosx.org/) [repo](https://github.com/openzfsonosx)
        !           187:   - proprietary ZFS in Solaris (not relevant in open source)
        !           188:   - ZFS as released under the CDDL (common ancestor, now of historical interest)
1.1       gdt       189: 
1.27    ! gdt       190: OpenZFS is a coordinating project to align open ZFS codebases.  There
        !           191: is a notion of a shared core codebase and OS-specific adaptation code.
1.1       gdt       192: 
1.27    ! gdt       193:   - [zfsonlinux relationship to OpenZFS](https://github.com/openzfs/zfs/wiki/OpenZFS-Patches)
        !           194:   - FreeBSD more or less imports code from openzfs and pushes back fixes. \verify
        !           195:   - NetBSD has imported code from FreeBSD
        !           196:   - The status of ZFS on macOS is unclear (2021-02)

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb