content/blog/2022-10-04-mtp-linux.org

e8577d98faff1bed72ba6f2d204b8b44c6827c23
cleberg.net/content/blog/2022-10-04-mtp-linux.org rendered · source · history · blame · raw

79 lines · 2572 bytes

 1#+date:        <2022-10-04 Tue 00:00:00>
 2#+title:       Mounting MTP Mobile Devices on Fedora Linux Systems
 3#+description: Instructions for mounting and accessing Media Transfer Protocol (MTP) compatible mobile devices on Fedora Linux using jmtpfs for file transfer and management.
 4#+slug:        mtp-linux
 5#+filetags:    :mtp:fedora:linux:
 6
 7I recently ran into trouble attempting to mount my GrapheneOS phone to
 8my laptop running Fedora Linux via the
 9[[https://en.wikipedia.org/wiki/Media_transfer_protocol][Media Transfer
10Protocol]] (MTP) and discovered a simple and effective solution.
11
12* Use a USB 3.0 Port
13
14First, ensure that the device was plugged in to the laptop through a USB
153.0 port, if possible. From a brief glance online, it seems that USB 2.0
16ports may cause issues with dropped connections over MTP. This is purely
17anecdotal since I don't have any evidence to link showing that USB 2.0
18causes issues, but I can confirm that switching to a USB 3.0 port seemed
19to cut out most of my issues.
20
21* Switch USB Preferences to MTP
22
23Secondly, you need to ensure that the phone's USB preferences/mode is
24changed to MTP or File Transfer once the phone is plugged in. Other
25modes will not allow you to access the phone's file system.
26
27* Install =jmtpfs=
28
29Next, I used the =jmtpfs= package to mount my phone to my laptop. There
30are other packages that exist, but this one worked perfectly for me. On
31Fedora Linux, you can install it like this:
32
33#+begin_src sh
34sudo dnf install jmtpfs -y
35#+end_src
36
37* Create a Mount Point
38
39Once you have the package installed, you just need to create a folder
40for the device to use as a mount point. In my case, I used =/mnt/pixel=:
41
42#+begin_src sh
43sudo mkdir /mnt/pixel
44sudo chown -R $USER:$USER /mnt/pixel
45#+end_src
46
47* Mount & Access the Phone's File System
48
49Finally, plug-in and mount the device, and you should be able to see all
50storage (internal and external) inside your new folder!
51
52#+begin_src sh
53jmtpfs /mnt/pixel
54#+end_src
55
56The output should look something like this:
57
58#+begin_src sh
59Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
60Android device detected, assigning default bug flags
61#+end_src
62
63Now you are mounted and can do anything you'd like with the device's
64files:
65
66#+begin_src sh
67cd /mnt/pixel
68ls -lha
69#+end_src
70
71From here, you will be able to see any internal or external storage
72available on the device:
73
74#+begin_src sh
75total 0
76drwxr-xr-x.  3 user user  0 Jan  1  1970  .
77drwxr-xr-x.  1 root root 10 Oct  4 13:29  ..
78drwxr-xr-x. 16 user user  0 Apr 21  4426383 'Internal shared storage'
79#+end_src