diff options
Diffstat (limited to 'blog/2022-10-04-mtp-linux.org')
-rw-r--r-- | blog/2022-10-04-mtp-linux.org | 116 |
1 files changed, 61 insertions, 55 deletions
diff --git a/blog/2022-10-04-mtp-linux.org b/blog/2022-10-04-mtp-linux.org index d2c0543..0117fbd 100644 --- a/blog/2022-10-04-mtp-linux.org +++ b/blog/2022-10-04-mtp-linux.org @@ -1,79 +1,85 @@ -+++ -date = 2022-10-04 -title = "How to Mount an MTP Mobile Device on Linux" -description = "Learn how to easily mount Android MTP smartphones on Linux using the command line." -+++ - -I recently ran into trouble attempting to mount my GrapheneOS phone to my laptop -running Fedora Linux via the [Media Transfer -Protocol](https://en.wikipedia.org/wiki/Media_transfer_protocol) (MTP) and -discovered a simple and effective solution. - -## Use a USB 3.0 Port - -First, ensure that the device was plugged in to the laptop through a -USB 3.0 port, if possible. From a brief glance online, it seems that USB 2.0 -ports may cause issues with dropped connections over MTP. This is purely -anecdotal since I don't have any evidence to link showing that USB 2.0 causes -issues, but I can confirm that switching to a USB 3.0 port seemed to cut out -most -of my issues. - -## Switch USB Preferences to MTP - -Secondly, you need to ensure that the phone's USB preferences/mode is -changed to MTP or File Transfer once the phone is plugged in. Other modes will -not allow you to access the phone's file system. - -## Install `jmtpfs` - -Next, I used the `jmtpfs` package to mount my phone to my laptop. There are -other packages that exist, but this one worked perfectly for me. On Fedora -Linux, you can install it like this: - -```sh +#+title: How to Mount an MTP Mobile Device on Linux +#+date: 2022-10-04 + +I recently ran into trouble attempting to mount my GrapheneOS phone to my laptop +running Fedora Linux via the [[https://en.wikipedia.org/wiki/Media_transfer_protocol][Media Transfer Protocol]] (MTP) and discovered a +simple and effective solution. + +** Use a USB 3.0 Port +:PROPERTIES: +:CUSTOM_ID: use-a-usb-3.0-port +:END: +First, ensure that the device was plugged in to the laptop through a USB +3.0 port, if possible. From a brief glance online, it seems that USB 2.0 +ports may cause issues with dropped connections over MTP. This is purely +anecdotal since I don't have any evidence to link showing that USB 2.0 +causes issues, but I can confirm that switching to a USB 3.0 port seemed +to cut out most of my issues. + +** Switch USB Preferences to MTP +:PROPERTIES: +:CUSTOM_ID: switch-usb-preferences-to-mtp +:END: +Secondly, you need to ensure that the phone's USB preferences/mode is +changed to MTP or File Transfer once the phone is plugged in. Other +modes will not allow you to access the phone's file system. + +** Install =jmtpfs= +:PROPERTIES: +:CUSTOM_ID: install-jmtpfs +:END: +Next, I used the =jmtpfs= package to mount my phone to my laptop. There +are other packages that exist, but this one worked perfectly for me. On +Fedora Linux, you can install it like this: + +#+begin_src sh sudo dnf install jmtpfs -y -``` +#+end_src -## Create a Mount Point +** Create a Mount Point +:PROPERTIES: +:CUSTOM_ID: create-a-mount-point +:END: +Once you have the package installed, you just need to create a folder +for the device to use as a mount point. In my case, I used =/mnt/pixel=: -Once you have the package installed, you just need to create a folder for the -device to use as a mount point. In my case, I used `/mnt/pixel`: - -```sh +#+begin_src sh sudo mkdir /mnt/pixel sudo chown -R $USER:$USER /mnt/pixel -``` - -## Mount & Access the Phone's File System +#+end_src -Finally, plug-in and mount the device, and you should be able to see all +** Mount & Access the Phone's File System +:PROPERTIES: +:CUSTOM_ID: mount-access-the-phones-file-system +:END: +Finally, plug-in and mount the device, and you should be able to see all storage (internal and external) inside your new folder! -```sh +#+begin_src sh jmtpfs /mnt/pixel -``` +#+end_src The output should look something like this: -```sh +#+begin_src sh Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP). Android device detected, assigning default bug flags -``` +#+end_src -Now you are mounted and can do anything you'd like with the device's files: +Now you are mounted and can do anything you'd like with the device's +files: -```sh +#+begin_src sh cd /mnt/pixel ls -lha -``` +#+end_src -From here, you will be able to see any internal or external storage available on -the device: +From here, you will be able to see any internal or external storage +available on the device: -```sh +#+begin_src sh total 0 drwxr-xr-x. 3 user user 0 Jan 1 1970 . drwxr-xr-x. 1 root root 10 Oct 4 13:29 .. drwxr-xr-x. 16 user user 0 Apr 21 4426383 'Internal shared storage' -``` +#+end_src |