File:  [NetBSD Developer Wiki] / wikisrc / zfs.mdwn
Revision 1.14: download - view: text, annotated - select for diffs
Mon Mar 2 00:41:17 2020 UTC (22 months, 4 weeks ago) by gdt
Branches: MAIN
CVS tags: HEAD
zfs: Add quick start and discuss pools/zvols

Explain the types of disks/partitions one can add to a pool.

Explain zvols briefly.

Give the briefest of quickstart and tell people again to read the
FreeBSD quickstart.

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

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