Jmtpfs is a combination of FUSE (Userspace Filesystem) and MTP (Media Transfer Protocol) stack integrated together to form a filesystem tool. The jmtpfs tool is then used to mount your smartphones or other handheld devices onto your Linux computer so that you can browse the content of your smartphone or handheld device directly from your computer.
What Is A FUSE Filesystem?
FUSE filesystem stands for Userspace Filesystem. In general cases, when you need to create your own filesystems, you need to have knowledge of the Operating System (OS) kernel and block storage device drivers. This would restrict the development of new filesystems to only kernel developers.
In Linux, in order to overcome this, a new type of filesystem model was introduced called the FUSE file system. In a FUSE filesystem, you will make use of a pre-written generic FUSE Linux kernel module, which you as a userspace developer need not have to modify. In addition to this, you will also make use of a pre-written FUSE userspace library that would provide the required API interfaces to the FUSE kernel modules form the userspace.
Using these two modules, it is now possible for the userspace developers to write their own filesystems by inserting the FUSE kernel module into their machine’s operating system and then writing their own filesystem with the help of FUSE library modules.
Such developed FUSE filesystems will place the files and directories exposed by the filesystem in the userspace region of the OS which is accessible by even non privileged users.
What Is Media Transfer Protocol (MTP)?
Media Transfer Protocol (MTP) is a type of protocol used to transfer media files such as audio files, videos files or image files at the file level rather than at the storage level. This protocol became a USB standard to transfer media files between a computer and a USB device.
The main reason why we would use an MTP protocol instead of the USB standard Mass Storage protocol is that when you use a Media Transfer Protocol (MTP) to transfer file, the whole file is transferred from the device to the computer or vice versa. So, the entire transfer of file happens as a single unit, hence transactional. In this way, both the device and host can continue to access the same file simultaneously, which is not possible when using a USB Mass Storage Device Class (MSC) protocol.
In case of an USB MSC protocol, when a USB mass storage device such as a music player is mounted on to a computer, the music player loses control over the files which is stored within itself and is taken over by the host computer’s filesystem. In this situation, the host computer can modify the content of the files and the USB device has no way to prevent it. This may lead to host computer corrupting the files of the USB mass storage device! But this situation is not at all possible when we use an MTP protocol due to its transactional file transfer nature. Hence MTP protocol is preferred over a USB MSC protocol.
JMPTFS tool makes use of both FUSE filesystem and the USB MTP protocol to mount the content of your smartphone onto a local directory on your computer, thereby giving access to the file contents of your smartphone even when you are a non privileged user.
How To Use Jmtpfs tool To Transfer Files From Your Smartphone
In order to use jmtpfs, you first need to create a local directory such as ‘myPhone’ in your computer. Next, you connect your Android or any other smartphone to your computer using an USB cable. Then by issuing the console command ‘jmtpfs myPhone’ you can mount the content of your smartphone onto your mount directory ‘myPhone’. In other words, after issuing the command, you will be able to browse the content of your smartphone within the mount directory ‘myPhone’ just like any other files and folders of your computer.
> mkdir ~/myPhone > jmtpfs ~/myPhone > ls myPhone Internal storage/
At the end, in order to unmount your smartphone filesystem from your computer, you need to issue another command:
> fusermount -u ~/myPhone
This should unmount your smartphone’s filesystem safely without corrupting any part of the filesystem on your smartphone.