1: # ZFS on NetBSD
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.
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.
12: # Documentation Pointers
14: See the man pages for zfs(8) and zpool(8).
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)
20: - [Wikipedia](https://en.wikipedia.org/wiki/ZFS)
22: # Status of ZFS in NetBSD
24: ## Sources of ZFS code
26: \todo Verify/fix.
28: Currently, there are multiple ZFS projects and codebases:
30: - ZFS as released under the CDDL (common ancestor)
31: - [OpenZFS](http://www.open-zfs.org/wiki/Main_Page) [github wiki](https://github.com/openzfs/zfs/wiki)
32: - [zfsonlinux](https://zfsonlinux.org/)
33: - [OpenZFS on OS X ](https://openzfsonosx.org/) [repo](https://github.com/openzfsonosx)
34: - proprietary ZFS in Solaris (not relevant in open source)
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: As of early 2020, it appears that there are two co-root repositories:
39: illumos and zfsonlinux, with a notion that fixes and improvements
40: should be cross-shared. This is different from the situation through
41: late 2019 where sharing was done via a designated sharing repository,
42: and appears to be a new, more efficient, procedure among cooperating
43: people, rather than any kind of fork.
45: - [deprecation of OpenZFS repo](https://github.com/openzfs/openzfs/)
46: - [zfsonlinux relationship to OpenZFS](https://github.com/openzfs/zfs/wiki/OpenZFS-Patches)
48: \todo Explain how FreeBSD code relates to zfsonlinux (imported/merged and fixes pushed upstream?).
50: \todo Explain how the NetBSD code relates (imported from FreeBSD? intent to continue to track?)
52: \todo Explain if NetBSD has a plan to join zfsonlinux as a first-class
53: member, vs tracking via FreeBSD.
55: \todo Explain how OpenZFS on OS X relates (tracks zfsonlinux?).
57: See [FreeBSD's history](https://wiki.freebsd.org/ZFSTuningGuide).
59: ## NetBSD code history
61: \todo This section really needs help.
63: Before NetBSD 8, NetBSD imported ZFS code from ?, which was version ?
65: Before NetBSD 9, NetBSD imported updated ZFS code from FreeBSD. That
66: FreeBSD code came from ?, which was version ?
68: ## NetBSD 8 and earlier
70: While there is some ZFS code, it is old, and seems to have significant
71: problems. If one wants to use ZFS, first upgrade to NetBSD 9. It is
72: unlikely that anyone is interested in helping, other than telling you
73: to upgrade to 9.
75: (Reports of how well NetBSD 8 works are welcome on netbsd-users, if it
76: can actually be recommended for use.)
78: ## NetBSD 9
80: There have been fixes since 9.0 RELEASE. It is best to upgrade along
81: the netbsd-9 branch, but the release should be ok. Most aspects work solidly.
83: \todo Explain this in terms of versions of FreeBSD OpenZFS and/or
86: \todo This supports pool version 28/5000 (really true?). Of the
87: feature flags found in modern OpenZFS, \todo are supported.
89: Generally, fixes to ZFS in current will be pulled up to 9, but new
90: features typically will not be.
92: ## NetBSD current
94: The ZFS code in current is very similar to that in 9.
96: There is initial support for [[ZFS root|wiki/RootOnZFS]], via booting from
97: ffs and pivoting.
99: One can make a ccd using a zvol as a component. See the zvol section below.
101: ## Things that aren't supported yet
103: \todo hotswap (maybe - not clear exactly what this means)
105: \todo direct boot into zfs root (via boot blocks reading zfs)
107: ## Architectures
109: Most people seem to be using amd64.
111: To build zfs, one puts MKZFS=yes in mk.conf. This is default on amd64
112: and aarch64 on netbsd-9. In current, it is also default on sparc64.
114: More or less, zfs can be enabled on an architecture when it is known
115: to build and run reliably. (Of course, users are welcome to build it
116: and report.)
118: # NetBSD-specific information
120: ## rc.conf
122: The main configuration is to put zfs=YES in rc.conf, so that the rc.d
123: scripts bring up ZFS and mount ZFS file systems.
125: ## pool locations
127: One can add disks or parts of disks into pools. Methods of specifying
128: areas to be included include:
130: - entire disks (e.g., /dev/rwd0d on amd64)
131: - disklabel partitions (e.g., /dev/sd0e)
132: - wedges (e.g., /dev/dk0)
134: ## legacy vs ? mount points
136: \todo Explain, if this is NetBSD specific. Explain consequences, as
137: this seems to have something to do with mount ordering.
139: ## mount order
141: NetBSD 9 mounts other file systems and then ZFS file systems. This can
142: be a problem if /usr/pkgsrc is on ZFS and /usr/pkgsrc/distfiles is on
143: NFS. A workaround is to use noauto and do the mounts in
146: NetBSD current after 20200301 mounts ZFS first. \todo Explain
149: ## NFS
151: \todo Verify if this is accurate.
153: zfs filesystems can be exported over NFS. While there are zfs
154: commands that appear to be about controlling exports, they simply
155: print information that can be added to exports(5).
157: This is reported to work on 9.0 STABLE, but to cause a panic on
158: current (20200302). See [misc/55042](http://gnats.netbsd.org/55042).
160: ## zvol
162: Within a ZFS pool, the standard approach is to have file systems, but
163: one can also create a zvol, which is a block device of a certain size.
165: \todo The zvol will appear as /dev/???? and can be used in many
166: respects like a slice. However, the system will not read disklabels
167: and gpt labels from a zvol; in this respect it is more like a disklabel
168: partition or wedge than a disk drive.
170: \todo Explain that one can export a zvol via iscsi.
172: \todo Explain if one can swap on a zvol.
174: \todo Explain that one can use ccd to create a normal-looking disk
175: from a zvol. This allows reading a GPT label from the zvol, which is
176: useful in case the zvol had been exported via iscsi and some other
177: system created a label.
179: ## TRIM
181: There is some notion of TRIM and zfs using it.
183: \todo Explain how this relates to NetBSD.
185: # Memory usage
187: Basically, ZFS uses lots of memory and most people run it on systems
188: with large amounts of memory. NetBSD works well on systems with
189: comparatively small amounts of memory. So a natural question is how
190: well ZFS works on one's VAX with 2M of RAM :-)
192: More seriously, one might ask if it is reasonable to run ZFS on a RPI3
193: with 1G of RAM, or even if it is reasonable on a system with 4G.
195: \todo Give ballpark level for minimum sane RAM, and the amount which
196: is cleanly enough.
198: For now, a good guess is that a 4G system with only 1T of disk is
199: probably ok, and that 1G is very likely not ok.
201: FreeBSD has some documentation about memory use. There is a notion of
202: a minimum of 1G (used for ZFS), and using 1G for 1T of storage, and
203: more if deduplication is enabled. FreeBSD considers all i386 systems
204: to be low memory; this appears to be a clue.
206: \todo Explain if the FreeBSD sysctl list applies, or if not what we
207: should do instead.
209: - [FreeBSD low memory documentation](https://www.freebsd.org/doc/handbook/zfs-advanced.html)
211: # Interoperability with other systems
213: \todo Explain pool version and feature flags relationship to FreeBSD,
214: Linux, OpenIndiana/Illumos/?, and ?
216: \todo Explain how to configure a pool in terms of version/features for
217: use with particula other systems.
219: # Quick Start
221: See the [FreeBSD Quickstart
222: Guide](https://www.freebsd.org/doc/handbook/zfs-quickstart.html); only
223: the first item is NetBSD specific.
225: - Put zfs=YES in rc.conf.
227: - Create a pool as "zpool create pool1 /dev/dk0".
229: - df and see /pool1
231: - Really, read the FreeBSD docs and the other linked documentation above.
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb