Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences between the datasets properties in zfs #469

Open
musjj opened this issue Dec 14, 2023 · 1 comment
Open

Differences between the datasets properties in zfs #469

musjj opened this issue Dec 14, 2023 · 1 comment
Labels
contributions welcome There's nothing left to discuss, feel free to submit a PR for this! documentation Issue that would be fixed by proper documentation

Comments

@musjj
Copy link

musjj commented Dec 14, 2023

I'm new to zfs and I'm kind of confused with the properties listed in the example: https://github.com/nix-community/disko/blob/master/example/zfs.nix

For example, there are apparently 3 ways of setting mountpoint:

  • datasets.*.mountpoint
  • datasets.*.options.mountpoint
  • datasets.*.content.mountpoint

Can anyone explain the differences and the CLI equivalent so I can look it up in the docs?

@TheRealGramdalf
Copy link

TheRealGramdalf commented Feb 14, 2024

  • datasets.*.mountpoint
  • This sets a "legacy" mountpoint, aka the fstab. Typical ZFS installations instead use the mountpoint property (see the next point)
  • datasets.*.options.mountpoint
  • This sets the respective zfsprop - the native feature used by ZFS to automatically mount datasets independently of fstab (typically via a systemd service that grabs information from the datasets and mounts it). datasets.*.options.* can actually be used to set any zfsprop - compression, encryption, or even custom user-specified ones like com.sun:auto-snapshot (which is used in second party tooling outside of ZFS, in this case some sort of sun microsystems thing).
  • datasets.*.content.mountpoint
  • This isn't actually valid - I believe you're referring to disko.devices.<devicename>.content.partitions.<partname>.content.mountpoint, not disko.devices.zpool.<zpoolname>.datasets.<datasetname>.content.mountpoint. In actuality it doesn't really matter - since neither are valid in the context - the former is only valid if disko.devices.<devicename>.content.partitions.<partname>.type is NOT zfs.
    • It essentially boils down to ambiguous wording - disko.devices.zpool is used to define the contents inside a zfs pool - datasets, zfs volumes, and their respective properties - whereas disko.devices.<devicename>... defines the physical layout of the zfs pool as a whole (what disks to use, whether to use an entire disk or a single partition etc). Disko further abstracts upon this by adding in custom glue in the form of mountpoint.
    • In my mind the best solution would be to rename mountpoint to something like fstabEntry to disambiguate the two - mountpoint is generic and has it's own special meaning in various contexts. One alternative (or additional?) solution would be to rename ...<datasetname>.options to ...<datasetname>.properties/zfsprops, since that aligns closer to the upstream implementation.

Edit:
Further confusion comes because in order to use an fstab entry to mount a zfs dataset, you need to set the zfsprop mountpoint=legacy for it to work properly.

p.s. I realize that changing an option name isn't ideal, but it's not unheard of, and is in my opinion better to do sooner rather than later, in case disko sees more widespread adoption and it becomes even more cemented. Part of the problem is also the lack of easily readable docs, so some of this concern may be invalid once those are available (though I personally prefer explicit configuration rather than ambiguous configuration).

DeadlySquad13 added a commit to DeadlySquad13/Unix_dotfiles that referenced this issue Aug 2, 2024
@iFreilicht iFreilicht added contributions welcome There's nothing left to discuss, feel free to submit a PR for this! documentation Issue that would be fixed by proper documentation labels Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome There's nothing left to discuss, feel free to submit a PR for this! documentation Issue that would be fixed by proper documentation
Projects
None yet
Development

No branches or pull requests

3 participants