-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fstab integration #6974
fstab integration #6974
Conversation
4041c9d
to
06b1a87
Compare
Generate an /etc/fstab section for zfs filesystems Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
06b1a87
to
1077db2
Compare
@kpande Good point: as it stands this is only useful for systemd. I've added and enabled options that are useful for systemd by default. Also, I'm definitely not suggesting this get run by default or anything like that---just have it available on people's systems. This patch is actually useful without #4943: the proper mount ordering can be discovered if you are mounting zfs on top of other (non-root) filesystems (bind mounts, etc.), which was the actual underlying motivation. |
Given that this is only useful for systemd, it seems better to focus on building a "proper" systemd generator. I'm not proposing a definition for "proper" at this time. |
@rlaager I agree. I considered two options for this integration: a "systemd-zfs-generator" that would run early in boot, or a direct modification of /etc/fstab. There are pros and cons to each of them. The systemd-zfs-generator only really seemed to me to have one advantage:
But putting all this junk in /etc/fstab can get out of sync with the options already stored in "the right place" in the filesystem itself, you say! Certainly that is a disadvantage! From
Emphasis added. We cannot hope to have access to the zpool (i.e., cannot run So, we need the dependency information, which is properly encoded in the file system hierarchy, at early boot time to generate the ideal boot ordering. Where should we store that? POSIX specifies that place: As an aside: if you have multiple pools, you would also like the ordering information to reflect the multiple pool imports, which can take quite a while. That information must also be necessarily stored outside the pool. |
Codecov Report
@@ Coverage Diff @@
## master #6974 +/- ##
==========================================
+ Coverage 75.55% 75.58% +0.02%
==========================================
Files 296 296
Lines 95483 95454 -29
==========================================
Hits 72145 72145
+ Misses 23338 23309 -29
Continue to review full report at Codecov.
|
I'll rework this idea and open another PR when it's ready. |
Generate a tracked, updateable section in /etc/fstab for zfs filesystems
Description
A contrib script fstab-generator is implemented that creates a trackable section in /etc/fstab (or another user-specified file) with fstab syntax reflecting the zfs mount and canmount parameters.
Motivation and Context
While #4943 implements a per-pool granular import, the user will still "need to add an entry like this in fstab:
rpool/home /home zfs rw,defaults,x-systemd.requires=zpool@rpool.service
This script performs precisely that mechanical task, allowing for filesystem dependencies to be correctly identified, and mounted in time to guarantee their availability. A monolithic import of all zfs filesystems is not required to have system files on native zfs mountpoints.
Moreover, by including this information in /etc/fstab, tools can fail appropriately if essential mountpoints are unavailable. This helps address the common annoyance where zfs fails to mount an important system directory, files then get placed on the zfs mountpoint, and then zfs will fail to mount on the subsequent boot (because overlay=off) even though the underlying problem was corrected.
Why not a systemd-generator?
Besides the obvious lack of integration for users without systemd, other tools may rely on /etc/fstab to determine what filesystems are present on a system. This approach immediately achieves integration with those tools--e.g., for analogous dependency tracking for other init systems that may develop in the future. Additionally, systemd generators may change syntax in the future, but they will have to remain compatible with /etc/fstab.
How Has This Been Tested?
I'm running with the output of this script on a machine that has several
/var/
directories, and/tmp
with purely zfs mountpoints.RFC
This is a work in progress.
%sbindir%
, etc?mount -ozfsutil
is ill-advised for zfs filesystems?Types of changes
Checklist:
Signed-off-by
.