Annotation of wikisrc/zfs.mdwn, revision 1.21

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.4       gdt        16:   - [Oracle ZFS Administration Manual](https://docs.oracle.com/cd/E26505_01/html/E37384/index.html)
                     17:   - [FreeBSD Handbook ZFS Chapter](https://www.freebsd.org/doc/handbook/zfs.html)
1.14      gdt        18:   - [OpenZFS admin docs index page](https://github.com/openzfs/zfs/wiki/Admin-Documentation)
1.1       gdt        19: 
1.21    ! gdt        20:   - https://en.wikipedia.org/wiki/ZFS
        !            21: 
1.1       gdt        22: # Status of ZFS in NetBSD
                     23: 
1.21    ! gdt        24: ## Sources of ZFS code
1.12      gdt        25: 
                     26: \todo Verify/fix.
                     27: 
1.21    ! gdt        28: Currently, there are multiple ZFS projects and codebases:
1.12      gdt        29: 
                     30:   - ZFS as released under the CDDL (common ancestor)
1.21    ! gdt        31:   - [OpenZFS](http://www.open-zfs.org/wiki/Main_Page) [github wiki](https://github.com/openzfs/zfs/wiki)
1.12      gdt        32:   - [zfsonlinux](https://zfsonlinux.org/)
1.21    ! gdt        33:   - [OpenZFS on OS X ](https://openzfsonosx.org/) [repo](https://github.com/openzfsonosx)
1.12      gdt        34:   - proprietary ZFS in Solaris (not relevant in open source)
                     35: 
                     36: OpenZFS is a coordinating project to align open ZFS codebases.  There
                     37: is a notion of a shared core codebase and OS-specific adaptation code.
                     38: 
1.21    ! gdt        39: \todo Explain clearly the relationship between OpenZFS and zfsonlinux,
        !            40: and also the Illumos and OSX versions.
        !            41: 
1.16      gdt        42: See [FreeBSD's history](https://wiki.freebsd.org/ZFSTuningGuide).
1.14      gdt        43: 
1.12      gdt        44: ## NetBSD code history
                     45: 
                     46: \todo This section really needs help.
                     47: 
                     48: Before NetBSD 8, NetBSD imported ZFS code from ?
                     49: 
                     50: Before NetBSD 9, NetBSD imported updated ZFS code from FreeBSD.  That
                     51: FreeBSD code came from ?
1.1       gdt        52: 
                     53: ## NetBSD 8 and earlier
                     54: 
                     55: While there is some ZFS code, it is old, and seems to have significant
                     56: problems.  If one wants to use ZFS, first upgrade to NetBSD 9.  It is
                     57: unlikely that anyone is interested in helping, other than telling you
                     58: to upgrade to 9.
                     59: 
1.13      wiz        60: (Reports of how well NetBSD 8 works are welcome on netbsd-users, if it
1.1       gdt        61: can actually be recommended for use.)
                     62: 
                     63: ## NetBSD 9
                     64: 
                     65: There have been fixes since 9.0 RELEASE.  It is best to upgrade along
1.12      gdt        66: the netbsd-9 branch, but the release should be ok.  Most aspects work solidly.
1.1       gdt        67: 
1.12      gdt        68: \todo Explain this in terms of versions of FreeBSD OpenZFS and/or
                     69: zfsonlinux.
1.1       gdt        70: 
                     71: \todo This supports pool version 28/5000 (really true?).  Of the
                     72: feature flags found in modern OpenZFS, \todo are supported.
                     73: 
1.7       gdt        74: Generally, fixes to ZFS in current will be pulled up to 9, but new
1.5       gdt        75: features typically will not be.
                     76: 
1.1       gdt        77: ## NetBSD current
                     78: 
1.5       gdt        79: The ZFS code in current is very similar to that in 9.
                     80: 
1.9       gdt        81: There is initial support for [[ZFS root|wiki/RootOnZFS]], via booting from
1.5       gdt        82: ffs and pivoting.
1.1       gdt        83: 
1.14      gdt        84: One can make a ccd using a zvol as a component.  See the zvol section below.
1.1       gdt        85: 
1.16      gdt        86: ## Things that aren't supported yet
1.1       gdt        87: 
1.8       gdt        88: \todo hotswap (maybe - not clear exactly what this means)
1.1       gdt        89: 
1.13      wiz        90: \todo direct boot into zfs root (via boot blocks reading zfs)
1.1       gdt        91: 
                     92: ## Architectures
                     93: 
                     94: Most people seem to be using amd64.
                     95: 
                     96: To build zfs, one puts MKZFS=yes in mk.conf.  This is default on amd64
                     97: and aarch64 on netbsd-9.  In current, it is also default on sparc64.
                     98: 
                     99: More or less, zfs can be enabled on an architecture when it is known
                    100: to build and run reliably.  (Of course, users are welcome to build it
                    101: and report.)
                    102: 
                    103: # NetBSD-specific information
                    104: 
                    105: ## rc.conf
                    106: 
                    107: The main configuration is to put zfs=YES in rc.conf, so that the rc.d
1.13      wiz       108: scripts bring up ZFS and mount ZFS file systems.
1.1       gdt       109: 
1.14      gdt       110: ## pool locations
                    111: 
                    112: One can add disks or parts of disks into pools.  Methods of specifying
                    113: areas to be included include:
                    114: 
                    115:   - entire disks (e.g., /dev/rwd0d on amd64)
                    116:   - disklabel partitions (e.g., /dev/sd0e)
                    117:   - wedges (e.g., /dev/dk0)
                    118: 
1.6       gdt       119: ## legacy vs ? mount points
                    120: 
                    121: \todo Explain, if this is NetBSD specific.  Explain consequences, as
                    122: this seems to have something to do with mount ordering.
                    123: 
1.1       gdt       124: ## mount order
                    125: 
1.13      wiz       126: NetBSD 9 mounts other file systems and then ZFS file systems.  This can
1.3       gdt       127: be a problem if /usr/pkgsrc is on ZFS and /usr/pkgsrc/distfiles is on
                    128: NFS.  A workaround is to use noauto and do the mounts in
                    129: /etc/rc.local.
                    130: 
                    131: NetBSD current after 20200301 mounts ZFS first. \todo Explain
                    132: consequences.
1.1       gdt       133: 
1.19      gdt       134: ## NFS
                    135: 
                    136: \todo Verify if this is accurate.
                    137: 
                    138: zfs filesystems can be exported over NFS.  While there are zfs
                    139: commands that appear to be about controlling exports, they simply
                    140: print information that can be added to exports(5).
                    141: 
1.20      gdt       142: This is reported to work on 9.0 STABLE, but to cause a panic on
                    143: current (20200302).
                    144: 
1.14      gdt       145: ## zvol
                    146: 
                    147: Within a ZFS pool, the standard approach is to have file systems, but
                    148: one can also create a zvol, which is a block device of a certain size.
                    149: 
                    150: \todo The zvol will appear as /dev/???? and can be used in many
                    151: respects like a slice.  However, the system will not read disklabels
                    152: and gpt labels from a zvol; in this respect it is more like a disklabel
                    153: partition or wedge than a disk drive.
                    154: 
                    155: \todo Explain that one can export a zvol via iscsi.
                    156: 
                    157: \todo Explain if one can swap on a zvol.
                    158: 
                    159: \todo Explain that one can use ccd to create a normal-looking disk
                    160: from a zvol.  This allows reading a GPT label from the zvol, which is
                    161: useful in case the zvol had been exported via iscsi and some other
                    162: system created a label.
                    163: 
1.1       gdt       164: ## TRIM
                    165: 
                    166: There is some notion of TRIM and zfs using it.
                    167: 
                    168: \todo Explain how this relates to NetBSD.
                    169: 
                    170: # Memory usage
                    171: 
                    172: Basically, ZFS uses lots of memory and most people run it on systems
                    173: with large amounts of memory.  NetBSD works well on systems with
                    174: comparatively small amounts of memory.  So a natural question is how
                    175: well ZFS works on one's VAX with 2M of RAM :-)
                    176: 
1.11      gdt       177: More seriously, one might ask if it is reasonable to run ZFS on a RPI3
1.1       gdt       178: with 1G of RAM, or even if it is reasonable on a system with 4G.
                    179: 
                    180: \todo Give ballpark level for minimum sane RAM, and the amount which
                    181: is cleanly enough.
                    182: 
1.10      gdt       183: For now, a good guess is that a 4G system with only 1T of disk is
1.18      gdt       184: probably ok, and that 1G is very likely not ok.
1.10      gdt       185: 
1.2       gdt       186: FreeBSD has some documentation about memory use.  There is a notion of
1.18      gdt       187: a minimum of 1G (used for ZFS), and using 1G for 1T of storage, and
                    188: more if deduplication is enabled.  FreeBSD considers all i386 systems
                    189: to be low memory; this appears to be a clue.
1.1       gdt       190: 
1.2       gdt       191: \todo Explain if the FreeBSD sysctl list applies, or if not what we
                    192: should do instead.
                    193: 
1.7       gdt       194:   - [FreeBSD low memory documentation](https://www.freebsd.org/doc/handbook/zfs-advanced.html)
1.1       gdt       195: 
                    196: # Interoperability with other systems
                    197: 
                    198: \todo Explain pool version and feature flags relationship to FreeBSD,
                    199: Linux, OpenIndiana/Illumos/?, and ?
                    200: 
1.18      gdt       201: \todo Explain how to configure a pool in terms of version/features for
                    202: use with particula other systems.
                    203: 
1.14      gdt       204: # Quick Start
                    205: 
                    206: See the [FreeBSD Quickstart
                    207: Guide](https://www.freebsd.org/doc/handbook/zfs-quickstart.html); only
                    208: the first item is NetBSD specific.
                    209: 
                    210:   - Put zfs=YES in rc.conf.
                    211: 
                    212:   - Create a pool as "zpool create pool1 /dev/dk0".
                    213: 
                    214:   - df and see /pool1
                    215: 
1.17      gdt       216:   - Really, read the FreeBSD docs and the other linked documentation above.

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