ubuntu-18.04 - Ubuntu 18.04 上的 zfs 传统挂载
问题描述
我在通用 Ubuntu 18.04 系统上使用 zfs。使用普通挂载点创建和挂载文件系统时一切正常。
但是,如果我可以使用在引导时自动挂载的传统挂载,我有一个用例会有所帮助。
如果我将传统挂载设置为noauto
然后在启动后手动挂载,一切正常。
但是当我删除时noauto
,我无法在启动时自动挂载。很明显问题出在哪里 - 在启动期间,在加载 ZFS 模块之前尝试安装驱动器:
$ systemctl status home-vagrant.mount
● home-vagrant.mount - /home/vagrant
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Thu 2020-04-30 11:41:07 PDT; 24s ago
Where: /home/vagrant
What: vagrant
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 464 ExecMount=/bin/mount vagrant /home/vagrant -t zfs (code=exited, status=2)
Apr 30 11:41:07 ubuntu mount[464]: The ZFS modules are not loaded.
Apr 30 11:41:07 ubuntu mount[464]: Try running '/sbin/modprobe zfs' as root to load them.
Apr 30 11:41:07 ubuntu systemd[1]: home-vagrant.mount: Mount process exited, code=exited status=2
Apr 30 11:41:07 ubuntu systemd[1]: home-vagrant.mount: Failed with result 'exit-code'.
Apr 30 11:41:07 ubuntu systemd[1]: Failed to mount /home/vagrant.
当然,稍后在引导过程中会加载 ZFS 模块并且可以正确挂载它。我可以在启动打印输出中看到这两个事件,很明显问题出在哪里 - 但不是修复。
我还没有找到一个简单的方法来处理这个问题。从我所见,似乎安装 zsh-initramfs 应该对此有所帮助 - 但是如何?
那里漂浮的少量信息似乎主要涉及将 zsh 用于根文件系统,并且在许多情况下要复杂得多。
部分用例可能会解释为什么我需要传统挂载 - 我有绑定挂载,这些挂载挂载在 ZFS 文件系统中。所以一种解决方法是使用链接而不是安装 - 如果我不能解决这个问题,那就是我要做的。
但这似乎应该是可行的!
解决方案
一种可能的解决方法是在您的 initrd 中加载 zfs 内核模块。我不确定 Ubuntu,但在 CentOS/Fedora 上,您可以在 /etc/sysconfig/modules 中添加一个脚本,该脚本在安装rootfs后立即执行。您可能想看看 Ubuntu 中是否有类似物。
推荐阅读
- variables - 在 include_role 中检测到更改时通知处理程序或注册 ansible 变量?
- r - 如何在 R 中使用 dplyr “在事件发生前”创建条件假人?
- javascript - javascript承诺使用firebase云功能的通知不会嵌套并返回错误
- node.js - 在不使用数据库触发器的情况下,无法使用 firebase 云功能更新 firebase 数据库
- django - Django - 使用外键检索多个级别的嵌套字段
- c# - 如何从命令行运行 dotnet core 应用程序?
- jquery - Jquery - 动态复选框/单选按钮 - 添加更多选项
- javascript - 为什么 LinkedIn auth 的脚本标签不是有效的 JavaScript?
- node.js - 如何使用 node js 创建动态网页?
- android - leanback:ImageViewCard 如何使信息块透明?