Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with fstab #44

Open
dannycjones opened this issue Jan 13, 2023 · 3 comments
Open

Compatibility with fstab #44

dannycjones opened this issue Jan 13, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@dannycjones
Copy link
Contributor

dannycjones commented Jan 13, 2023

Some users of file connectors may rely on fstab to manage mounting file systems in their Linux operating system.

More info on fstab: https://www.redhat.com/sysadmin/etc-fstab

@dannycjones
Copy link
Contributor Author

dannycjones commented Feb 22, 2023

I gave this a go just now; I'm getting the following error as the connector doesn't accept arguments via -o yet. (I also dump the args before parsing.)

ubuntu@ip-172-31-37-193:~$ sudo mount /mnt/s3-file-connector
["s3-file-connector", "djonesoa-eu-west-1", "/mnt/s3-file-connector", "-o", "rw,endpoint_url=https://s3.eu-west-1.amazonaws.com,dev,suid"]
error: Found argument '-o' which wasn't expected, or isn't valid in this context

	If you tried to supply `-o` as a value rather than a flag, use `-- -o`

USAGE:
    s3-file-connector [OPTIONS] <BUCKET_NAME> <MOUNT_POINT>

For more information try --help

Using this in /etc/fstab:

djonesoa-eu-west-1 /mnt/s3-file-connector fuse.s3-file-connector defaults,endpoint_url=https://s3.eu-west-1.amazonaws.com 0 0

@dannycjones
Copy link
Contributor Author

dannycjones commented Feb 22, 2023

If we did want to support the use of fstab, we'd need to allow -o options to be set and also overwrite existing options that might have been set in fstab, such as the endpoint URL.

We might use argument delimiter to support -o, but handling unexpected options or ones that are normally full arguments is unclear.

@StarlightSyndrome
Copy link

StarlightSyndrome commented Nov 22, 2023

This is somehow an additional info/request for implementing this feature.

I just have setup mount-s3 with systemd automount with a light wrapper script that does the actual mounting. A line in fstab would look like this

my-s3-bucket /s3/my-s3-bucket fuse.mount-s3.sh noauto,x-systemd.automount,--read-only,--allow-other

where the /usr/local/bin/mount-s3.sh script extracts the source, target, and the double dashed options and calls mount-s3 with it.

While this approach works well with autofs it does not with systemd automount since the latter already creates a mount on the target:

$ cat /proc/mounts
...
systemd-1 on /s3/my-s3-bucket type autofs (rw,relatime,fd=55,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
...

Subsequently mount-s3 fails on the actual mounting during triggered by accessing the mount point with:
Error: mount point /s3/my-s3-bucket is already mounted.

Basically it shall be enough to check the fs type on the mountpoint. If it is autofs it can be ignored.

Also I suggest that either we could filter the (comma separated) options passed by -o for those options with double dashes. Or we introduce our own parameter that can hold all our options like so:

my-s3-bucket /s3/my-s3-bucket fuse.mount-s3 noauto,x-systemd.automount,mount-s3-options=read-only,allow-other,max-threads=24

This parameter has to be put at the end of the the fstab options so everything following the mount-s3-options= can be considered mount-s3 arguments and parameters.

Alternatively without mount-s3-options= all parameters in the fourth argument could be tested if they are valid mount-s3 parameters and used if true.

Also note that the fuse.mount-s3-do wrapper script will not be needed any more. Just a fuse.mount-s3 will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants