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

后端 未结 5 1060
醉酒成梦
醉酒成梦 2021-01-31 03:08

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

5条回答
  •  孤街浪徒
    2021-01-31 03:51

    To clarify @patryk.beza comment on the accepted answer, the correct way to mount a FUSE file system is by setting the file system type to fuse..

    For example, to mount an s3fs-fuse implementation, which does not provide a specific /sbin/mount.* wrapper and uses normally the s3fs user command to mount S3 buckets, one can use this command as root:

    mount -t fuse.s3fs bucket-name /path/to/dir -o 
    

    or this line in /etc/fstab:

    bucket-name /path/to/dir fuse.s3fs  0 0
    

    or this SystemD mount unit (for example, /etc/systemd/system/path-to-dir.mount):

    [Unit]
    Description=S3 Storage
    After=network.target
    
    [Mount]
    What=bucket-name
    Where=/path/to/dir
    Type=fuse.s3fs
    Options=
    
    [Install]
    WantedBy=multi-user.target
    

    How this works: mount recognizes the concept of "filesystem subtypes" when the type is formatted with a period (i.e. .), so that a type with the format fuse.someimpl is recognized to be the responsibility of the FUSE mount helper /sbin/mount.fuse. The FUSE mount helper then resolves the someimpl part to the FUSE implementation, in the same way as the # format is used in the original answer (I think this is just a path search for a program named , but I'm not 100% sure about it).

提交回复
热议问题