--- wikisrc/zfs.mdwn 2020/06/24 15:19:56 1.26 +++ wikisrc/zfs.mdwn 2021/02/12 14:28:54 1.27 @@ -13,96 +13,44 @@ statement needs verification. See the man pages for zfs(8) and zpool(8). - - [Oracle ZFS Administration Manual](https://docs.oracle.com/cd/E26505_01/html/E37384/index.html) - - [FreeBSD Handbook ZFS Chapter](https://www.freebsd.org/doc/handbook/zfs.html) + - [OpenZFS Documentation](https://openzfs.github.io/openzfs-docs/) - [OpenZFS admin docs index page](https://github.com/openzfs/zfs/wiki/Admin-Documentation) - + - [FreeBSD Handbook ZFS Chapter](https://www.freebsd.org/doc/handbook/zfs.html) + - [Oracle ZFS Administration Manual](https://docs.oracle.com/cd/E26505_01/html/E37384/index.html) - [Wikipedia](https://en.wikipedia.org/wiki/ZFS) # Status of ZFS in NetBSD -## Sources of ZFS code - -\todo Verify/fix. - -Currently, there are multiple ZFS projects and codebases: - - - ZFS as released under the CDDL (common ancestor) - - [OpenZFS](http://www.open-zfs.org/wiki/Main_Page) [github wiki](https://github.com/openzfs/zfs/wiki) - - [zfsonlinux](https://zfsonlinux.org/) - - [OpenZFS on OS X ](https://openzfsonosx.org/) [repo](https://github.com/openzfsonosx) - - proprietary ZFS in Solaris (not relevant in open source) - -OpenZFS is a coordinating project to align open ZFS codebases. There -is a notion of a shared core codebase and OS-specific adaptation code. -As of early 2020, it appears that there are two co-root repositories: -illumos and zfsonlinux, with a notion that fixes and improvements -should be cross-shared. This is different from the situation through -late 2019 where sharing was done via a designated sharing repository, -and appears to be a new, more efficient, procedure among cooperating -people, rather than any kind of fork. - - - [deprecation of OpenZFS repo](https://github.com/openzfs/openzfs/) - - [zfsonlinux relationship to OpenZFS](https://github.com/openzfs/zfs/wiki/OpenZFS-Patches) - -\todo Explain how FreeBSD code relates to zfsonlinux (imported/merged and fixes pushed upstream?). - -\todo Explain how the NetBSD code relates (imported from FreeBSD? intent to continue to track?) +## NetBSD 8 -\todo Explain if NetBSD has a plan to join zfsonlinux as a first-class -member, vs tracking via FreeBSD. - -\todo Explain how OpenZFS on OS X relates (tracks zfsonlinux?). - -See [FreeBSD's history](https://wiki.freebsd.org/ZFSTuningGuide). - -## NetBSD code history - -\todo This section really needs help. - -Before NetBSD 8, NetBSD imported ZFS code from ?, which was version ? - -Before NetBSD 9, NetBSD imported updated ZFS code from FreeBSD. That -FreeBSD code came from ?, which was version ? - -## NetBSD 8 and earlier - -While there is some ZFS code, it is old, and seems to have significant -problems. If one wants to use ZFS, first upgrade to NetBSD 9. It is -unlikely that anyone is interested in helping, other than telling you -to upgrade to 9. - -(Reports of how well NetBSD 8 works are welcome on netbsd-users, if it -can actually be recommended for use.) +NetBSD 8 has an old version of ZFS, and it is not recommended for use +at all. There is no evidence that anyone is interested in helping +with ZFS on 8. Those wishing to use ZFS on NetBSD 8 should therefore +update to NetBSD 9. ## NetBSD 9 -There have been fixes since 9.0 RELEASE. It is best to upgrade along -the netbsd-9 branch, but the release should be ok. Most aspects work solidly. +NetBSD-9 has ZFS that is considered to work well. There have been +fixes since 9.0_RELEASE. As always, people running NetBSD 9 are +likely best served by the most recent version of the netbsd-9 stable +branch. As of 2021-02, ZFS in the NetBSD 9.1 release is very close to +netbsd-9. -\todo Explain this in terms of versions of FreeBSD OpenZFS and/or -zfsonlinux. +## NetBSD-current -\todo This supports pool version 28/5000 (really true?). Of the -feature flags found in modern OpenZFS, \todo are supported. - -Generally, fixes to ZFS in current will be pulled up to 9, but new -features typically will not be. - -## NetBSD current - -The ZFS code in current is very similar to that in 9. +NetBSD-current (as of 2021-02) has similar ZFS code to 9. There is initial support for [[ZFS root|wiki/RootOnZFS]], via booting from ffs and pivoting. -One can make a ccd using a zvol as a component. See the zvol section below. +## NetBSD/xen special issues -## Things that aren't supported yet +In NetBSD-9, MAXPHYS is 64KB in most places, but because of xbd(4) it +is set to 32KB for XEN kernels. Thus the standard zfs kernel modules +do not work under xen. In NetBSD-current, xbd(4) supports 64 KB +MAXPHYS and this is no longer an issue. -\todo hotswap (maybe - not clear exactly what this means) - -\todo direct boot into zfs root (via boot blocks reading zfs) +Xen and zfs on current are reported to work well together, as of 2021-02. ## Architectures @@ -115,6 +63,23 @@ More or less, zfs can be enabled on an a to build and run reliably. (Of course, users are welcome to build it and report.) +# Quick Start + +See the [FreeBSD Quickstart +Guide](https://www.freebsd.org/doc/handbook/zfs-quickstart.html); only +the first item is NetBSD specific. + + - Put zfs=YES in rc.conf. + + - Create a pool as "zpool create pool1 /dev/dk0". + + - df and see /pool1 + + - Create a filesystem mounted on /n0 as "zfs create -o + mountpoint=/n0 pool1/n0". + + - Go back and read the documentation and start over. + # NetBSD-specific information ## rc.conf @@ -127,15 +92,10 @@ scripts bring up ZFS and mount ZFS file One can add disks or parts of disks into pools. Methods of specifying areas to be included include: - - entire disks (e.g., /dev/rwd0d on amd64) + - entire disks (e.g., /dev/wd0d on amd64) - disklabel partitions (e.g., /dev/sd0e) - wedges (e.g., /dev/dk0) -## legacy vs ? mount points - -\todo Explain, if this is NetBSD specific. Explain consequences, as -this seems to have something to do with mount ordering. - ## mount order NetBSD 9 mounts other file systems and then ZFS file systems. This can @@ -143,16 +103,17 @@ be a problem if /usr/pkgsrc is on ZFS an NFS. A workaround is to use noauto and do the mounts in /etc/rc.local. -NetBSD current after 20200301 mounts ZFS first. \todo Explain -consequences. +NetBSD current after 20200301 mounts ZFS first. The same issues and +workarounds apply in different circumstances. ## NFS -\todo Verify if this is accurate. +zfs filesystems are reported to be exportable over NFS. + +The "zfs share" command adds a line to /etc/zfs/exports, and "zfs +unshare" removes it. -zfs filesystems can be exported over NFS. While there are zfs -commands that appear to be about controlling exports, they simply -print information that can be added to exports(5). +\todo Explain how /etc/zfs/exports is used. This is reported to work on 9.0 STABLE, but to cause a panic on current (20200302). See [misc/55042](http://gnats.netbsd.org/55042). @@ -176,61 +137,60 @@ from a zvol. This allows reading a GPT useful in case the zvol had been exported via iscsi and some other system created a label. -## TRIM - -There is some notion of TRIM and zfs using it. - -\todo Explain how this relates to NetBSD. - # Memory usage Basically, ZFS uses lots of memory and most people run it on systems with large amounts of memory. NetBSD works well on systems with comparatively small amounts of memory. So a natural question is how -well ZFS works on one's VAX with 2M of RAM :-) - -More seriously, one might ask if it is reasonable to run ZFS on a RPI3 -with 1G of RAM, or even if it is reasonable on a system with 4G. - -\todo Give ballpark level for minimum sane RAM, and the amount which -is cleanly enough. - -For now, a good guess is that a 4G system with only 1T of disk is -probably ok, and that 1G is very likely not ok. - -Besides RAM, zfs requires that architecture kernel stack size is at least 12KB or more - some -operations cause stack overflow with 8KB kernel stack. On NetBSD, the architectures -with 16KB kernel stack are amd64, sparc64, powerpc, and experimental ia64, hppa. mac68k and sh3 have 12KB kernel -stack. All others use only 8KB stack, which is not enough to run zfs. - -FreeBSD has some documentation about memory use. There is a notion of -a minimum of 1G (used for ZFS), and using 1G for 1T of storage, and -more if deduplication is enabled. FreeBSD considers all i386 systems -to be low memory; this appears to be a clue. - -\todo Explain if the FreeBSD sysctl list applies, or if not what we -should do instead. - - - [FreeBSD low memory documentation](https://www.freebsd.org/doc/handbook/zfs-advanced.html) +well ZFS works on one's VAX with 2M of RAM :-) More seriously, one +might ask if it is reasonable to run ZFS on a RPI3 with 1G of RAM, or +if it is reasonable on a system with 4G. + +The prevailing wisdom is more or less that ZFS consumes 1G plus 1G per +1T of disk. 32-bit architectures are viewed as too small to run ZFS. + +Besides RAM, zfs requires that architecture kernel stack size is at +least 12KB or more -- some operations cause stack overflow with 8KB +kernel stack. On NetBSD, the architectures with 16KB kernel stack are +amd64, sparc64, powerpc, and experimental ia64, hppa. mac68k and sh3 +have 12KB kernel stack. All others use only 8KB stack, which is not +enough to run zfs. + +NetBSD has many statistics provided via sysctl; see "sysctl +kstat.zfs". + +FreeBSD has tunables that NetBSD does not seem to have, described in +[FreeBSD Handbook ZFS Advanced +section](https://docs.freebsd.org/en/books/handbook/zfs/#zfs-advanced). # Interoperability with other systems -\todo Explain pool version and feature flags relationship to FreeBSD, -Linux, OpenIndiana/Illumos/?, and ? +Modern ZFS uses pool version 5000 and feature flags. -\todo Explain how to configure a pool in terms of version/features for -use with particula other systems. +It is in general possible to export a pool and them import the pool on +some other system, as long as the other system supports all the used +features. -# Quick Start +\todo Explain how to do this and what is known to work. -See the [FreeBSD Quickstart -Guide](https://www.freebsd.org/doc/handbook/zfs-quickstart.html); only -the first item is NetBSD specific. +\todo Explain feature flags relationship to FreeBSD, Linux, iIllumos, +macOS. - - Put zfs=YES in rc.conf. +# Sources of ZFS code - - Create a pool as "zpool create pool1 /dev/dk0". +Currently, there are multiple ZFS projects and codebases: - - df and see /pool1 + - [OpenZFS](http://www.open-zfs.org/wiki/Main_Page) + - [openzfs repository](https://github.com/openzfs/zfs} + - [zfsonlinux](https://zfsonlinux.org/) + - [OpenZFS on OS X ](https://openzfsonosx.org/) [repo](https://github.com/openzfsonosx) + - proprietary ZFS in Solaris (not relevant in open source) + - ZFS as released under the CDDL (common ancestor, now of historical interest) - - Really, read the FreeBSD docs and the other linked documentation above. +OpenZFS is a coordinating project to align open ZFS codebases. There +is a notion of a shared core codebase and OS-specific adaptation code. + + - [zfsonlinux relationship to OpenZFS](https://github.com/openzfs/zfs/wiki/OpenZFS-Patches) + - FreeBSD more or less imports code from openzfs and pushes back fixes. \verify + - NetBSD has imported code from FreeBSD + - The status of ZFS on macOS is unclear (2021-02)