Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to register FUSE filesystem type with mount(8) and fstab?

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.

like image 947
drdaeman Avatar asked Oct 12 '09 12:10

drdaeman


People also ask

What is FUSE file system type?

FUSE (Filesystem in Userspace) is a simple interface for userspace programs to export a virtual filesystem to the Linux kernel. FUSE also aims to provide a secure method for non privileged users to create and mount their own filesystem implementations.

What command is used to mount all existing filesystems in etc fstab?

Command-line options available for the mount command are: -a, --all Mount all filesystems (of the given types) mentioned in fstab (except for those whose line contains the noauto keyword). The filesystems are mounted following their order in fstab.


1 Answers

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#.

like image 55
ephemient Avatar answered Sep 17 '22 17:09

ephemient