phatina / simple-mtpfs

Simple MTP fuse filesystem driver.
GNU General Public License v2.0
371 stars 45 forks source link

Mounting via fstab #4

Closed mad-ady closed 11 years ago

mad-ady commented 11 years ago

I am able to use simple-mtpfs to mount and unmount my Galaxy S3. I'd like to do it via /etc/fstab and here's what I've tried:

simple-mtpfs#/ /media/phone-mtp fuse user,fsname=simple-mtpfs#/,noauto 0 0

With this setup I get the following error when I try to mount it: adrianp@frost:~$ mount /media/phone-mtp Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note. fuse: invalid argument `/media/phone-mtp'

A different way I tried it is:

simple-mtpfs# /media/phone-mtp fuse user,fsname=simple-mtpfs#,noauto 0 0

... with this result:

adrianp@frost:~$ mount /media/phone-mtp Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note. fuse: bad mount point `': No such file or directory

The problem seems to be the fact that fstab expects a mount device in addition to a mount point. Using a fake device generates errors though.

Is there a way to mount via fstab? Thanks

phatina commented 11 years ago

simple-mtpfs expects only mount point, not a device path. This is due to libmtp, which does not use any kind of device path for mounting - it uses numeric order of the device to comunicate to.

You can workaround that problem by creating a simple shell script, which passes all the arguments to simple-mtpfs except the first one. Is this OK for you?

mad-ady commented 11 years ago

Thanks for the reply.

I made a simple wrapper script to take care of the arguments:

adrianp@frost:~$ cat /sbin/mtpfswrapper

!/bin/bash

echo "Called with parameters:" $@; simple-mtpfs $2 $3 $4

My fstab entry looks like this: mtpfswrapper#/dev/fake /media/phone-mtp fuse user,fsname=mtpfswrapper#/dev/fake,noauto 0 0

phatina commented 11 years ago

I am glad, it works as expected, now.

phatina commented 11 years ago

Now, you can throw away the wrapper script. See wiki page about mounting with special file as the first parameter.