问题描述
我已经写了一个小型的基于FUSE的文件系统,现在唯一缺少的部分就是我想用fstab(5)注册它,以便在系统启动时自动挂载它,并且/或者手动挂载 mount / srv / virtual-db
。我知道,我可以运行 /usr/bin/vdbfs.py / srv / virtual-db
对不起,因为这可能不完全是一个编程问题,但它是高度相关的,因为打包和部署仍然是程序员的工作。通常,通过创建一个新的挂载文件系统类型,注册一个新的挂载文件系统类型一个可执行文件 mount.fstype
。
$ ln -s / usr / bin / vdbfs.py /usr/sbin/mount.vdbfs
如果 vdbfs.py
需要 mount
-ish参数(即 dev path [-o opts]
),然后 mount -t vdbfs
并使用 vdbfs
作为 fstab
中的第三个字段。如果没有的话,你可以创建一个包装器,它包含了这个表单的参数,并将它们映射到你的 vdbfs.py
所需的任何地方。
FUSE还应该安装 mount.fuse
可执行文件; mount.fuse'vdbfs.py#dev'path -o opts
将继续并调用 vdbfs.py dev path -o opts
。在这种情况下,可以使用 fuse
作为文件系统类型,并在 vdbfs.py#
p>
I've written a small FUSE-based filesystem and now the only part's missing is that I want to register it with fstab(5) to auto-mount it on system startup and/or manually mount it with just mount /srv/virtual-db
. How can I achieve this?
I know, I can just run /usr/bin/vdbfs.py /srv/virtual-db
from some init script, but that's not exactly pretty.
I'm sorry because this may be not exactly a programming question, but it's highly related, as the packaging and deployment is still the programmer's job.
解决方案 In general, one "registers" a new mount filesystem type by creating an executable mount.fstype
.
$ ln -s /usr/bin/vdbfs.py /usr/sbin/mount.vdbfs
If vdbfs.py
takes mount
-ish arguments (i.e. dev path [-o opts]
), then mount -t vdbfs
and using vdbfs
as the 3rd field in fstab
will work. If it doesn't, you can create a wrapper which does take arguments of that form and maps them to whatever your vdbfs.py
takes.
FUSE should also install a mount.fuse
executable; mount.fuse 'vdbfs.py#dev' path -o opts
will go on and call vdbfs.py dev path -o opts
. In that case, you can use fuse
as your filesystem type and prefix your device with vdbfs.py#
.
这篇关于如何使用mount(8)和fstab注册FUSE文件系统类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!