Table of Contents
About
SIMPLE-MTPFS (Simple Media Transfer Protocol FileSystem) is a file system for Linux (and other operating systems with a FUSE implementation, such as Mac OS X or FreeBSD) capable of operating on files on MTP devices attached via USB to local machine. On the local computer where the SIMPLE-MTPFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with MTP device files.
Installing
Simple-mtpfs depends on fuse (version >2.8) and libmtp. It also requires the C++ compiler to support c++11 standard.
To install the driver, follow these steps:
$ mkdir build && cd build
$ ../configure
$ make
$ make install (as root)
The project can be set to use custom directory for temporary files. To configure
the simple-mtpfs to use desired temporary directory, add --with-tmpdir=TMPDIR
option to configure script. Default value for temporary directory is /tmp
. This
option can be handy, if e.g. /tmp
is mounted using tmpfs and you are running a
system with little physical memory.
NOTE: This option modifies the default directory (set at compile time)
for the simple-mtpfs. Anytime, you can override this setting by exporting environment
variable TMP
or TMPDIR
.
If you got the sources from git repository, first you have to run:
$ ./autogen.sh
Usage
This section covers most common use cases of SIMPLE-MTPFS.
Device listing
To print a list of devices, that are connected, run following:
$ simple-mtpfs --list-devices
1: SonyEricssonLT15i (Xperia arc S)
2: SamsungGalaxy models (MTP+ADB)
Mounting
To mount MTP-based device to your local filesystem, simply run:
$ simple-mtpfs mount_pount [options]
In case, you have more than one mtp-based device connected, you can specify, which device to mount.
$ simple-mtpfs --device <device_number> mount_point [options]
Or use special character file present in the /dev directory, e.g.:
$ simple-mtpfs /dev/libmtp-2-1.5.6 mount_point [options]
Where /dev/libmtp-2-1.5.6
is symbolic link to /dev/bus/usb/xxx/yyy
.
Unmounting
To unmount your mtp-based device, execute this:
$ fusermount -u <mount_point>
Move-operation
Due to MTP protocol logic, there can not be a full move-operation executed. By default, you can not move any file/folder in the mtp-based device storage. You can enable software emulation of this operation by passing a mount parameter -o enable-move
. Move emulation means, that the content is first copied to temporary location, removed on the device and then copied back (moved, renamed). Following example shows, how to mount with move-operation enabled.
$ simple-mtpfs <source> mount_point -o enable-move [options]
Temporary directory
Again, due to MTP protocol logic, true read/write operations can be performed on files, that are temporarily copied on a local filesystem. By default, all the temporary files are stored in /tmp/simple-mtpfs-XXXXXX, where XXXXXX is a random string for each mount different. You can specify your desired temporary directory for SIMPLE-MTPFS by running:
$ TMPDIR=<path> simple-mtpfs <source> mount_point [options]
Configuration
Udev Rule
It is possible to create a custom symlink for your MTP-based device. This is especially good, when automounting a device.
NOTE: This example is done for Samsung Galaxy Nexus phone.
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="685c", SYMLINK="nexus"