7

According to Gnome / Nautilus, these files reside at: mtp://[usb:001,007]

But:

$ cd mtp://[usb:001,007]
bash: cd: mtp://[usb:001,007]: No such file or directory

And df -h doesn't list it.

While lsusb suggests it's there:

Bus 001 Device 008: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)

  • 1
    cd is to change directory, not to mount a device. What tells you it's mounted? Is it visible in mount? If not, then you need to mount it first. – Julie Pelletier Sep 23 '16 at 3:53
  • I'm able to access the files through the GUI. – zadrozny Sep 23 '16 at 13:46
2

Short answer: You can’t cd to this directory.

Media Transfer Protocol (MTP)

Media Transfer Protocol (MTP) uses a special API that to provide limited access to files on a device. As I understand it, it was originally designed by Microsoft for use with proprietary software compatible with its digital restriction system.

The protocol became an official USB device class in 2008 and it provides a standard means of transferring media and metadata between a computer and an external device. It is not tied to DRM and the ever-innovative FOSS community developed the libmtp library to support MTP devices.

The mtp://[usb:001,007] URL is a GNOME Virtual file system which uses libmtp as its backend. Since MTP abstracts away the filesystem, it’s not mounted in the same way as a regular storage device so it will not be listed by the mount or df commands.

The MTP Wikipedia article has a good description of the protocol and lists the advantages to using MTP for accessing files on an external device.

The comprehensive MTP article on the Arch Linux Wiki has tonnes of useful information on using MTP with GNU/Linux (most of the information is not distribution-specific).

Mass Storage Class (MSC)

If you want to treat the files on the Samsung device as a regular filesystem that can be mounted like any other storage device (and use cd), you would need to configure the device to present itself as a Mass Storage Class (MSC) (aka UMS) device. Some devices can be configured to use either method. I have a Sony Android phone that allows either method but I’ve always connected to its SD card using USB Mass Storage (even though it means the Android OS has to unmount the SD card, to allow the GNU/Linux OS to mount it).

  • Great info Anthony :) – Arnab Sep 23 '16 at 23:28
  • All this discussion of MTP vs MSC is irrelevant and misleading. The reason you can't cd to this directory has nothing to do with MTP. It's because the MTP driver is a Gnome driver rather than a Linux driver, so it's only visible to applications that use the Gnome filesystem layer (GVFS). The advantage of the Gnome driver is that it's part of the default installation. You can't see GVFS filesystems in the shell because the shell isn't a Gnome application. – Gilles 'SO- stop being evil' Sep 25 '16 at 0:04
  • This answer is actually wrong - see @Arnab post for a correct answer (and working solution). – bagage May 29 '18 at 10:41
8

You actually can go to that folder with cd. Though mount or df commands can't list it, but it's available under a gvfsd-fuse mounted folder, in my case it's /run/user/1000/gvfs , find out that with

mount | grep  'gvfsd-fuse'

The mounted MTP device's filesystems are available under that folder with some crappy name.

Use cd and Tab key for easier navigation. enter image description here

Some systems don't have gvfsd-fuse running by default. Make sure that you have it installed (on Debian and derivatives, it's in the gvfs-fuse package).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.