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

有些话、适合烂在心里 提交于 2019-12-02 17:04:40

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

ejm

So to clarify ephemient's answer, there are two options:

  1. Edit /etc/fstab like this:

    # <file system>   <mount point>      <type>  <options>         <dump>  <pass>
    # ...
    vdbfs.py#<dev>    /srv/virtual-db    fuse    user,<other-opts>    0    0
    

    Or,

  2. Create an executable prefixed with "mount." (ensuring it can be used with mount-like options):

    $ ln -s /usr/bin/vdbfs.py /usr/sbin/mount.vdbfs
    

    And edit /etc/fstab like this:

    # <file system> <mount point> <type>    <options>         <dump>  <pass>
    # ...
    <dev>    /srv/virtual-db    vdbfs.py    user,<other-opts>    0    0
    

With regards to auto-mounting at start up and manually mounting with mount, the user and noauto options are relevant and fully supported by fuse itself so you don't have to implement them yourself. The user option lets a non-priveleged user who is a member of the "fuse" group mount your filesystem with the mount command, and noauto directs your filesystem not to automatically mount at startup. If you don't specify noauto, it will automatically mount.

You could just use fuse filesystem type. The following works on my system:

smbnetfs    /media/netbios    fuse    defaults,allow_other    0    0

Another example:

sshfs#user@example.com:/    /mnt    fuse    user,noauto    0    0

After researching a lot found this solution to mount fuse filesystem suing fstab entry. I was using fuse for s3bucket to mount on local linux machine.

  • .passwd-s3fs : Is containing credentials to access your aws account 1] Secret key and 2] Access Key .
  • uid : User Id. You can type linux command id and you can get uid

Syntax:

s3fs#<Bucket_Name> <Mounted_Direcotry_Path> fuse _netdev,allow_other,passwd_file=/home/ubuntu/.passwd-s3fs,use_cache=/tmp,umask=002,uid=<User_Id> 0 0

Example:

s3fs#myawsbucket /home/ubuntu/s3bucket/mys3bucket fuse _netdev,allow_other,passwd_file=/home/ubuntu/.passwd-s3fs,use_cache=/tmp,umask=002,uid=1000 0 0

To mount you need run following command.

mount -a

To check your bucket is mounted properly or not use following command to check which shows all mounted points.

df -h
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!