5

Is the Ubuntu phone filesystem mountable in Linux via a usb connection?

Is there reason to believe this feature is here to stay? For me rather than full desktop/phone convergence, I'd be happy with being able to use my phone as the place I store all my essential data (as in a usb stick) and then use it on my phone or share it with my laptop whenever I need to.

2
  • Mountable as filesystem (like usb stick) or you are talking about docking?
    – Braiam
    Oct 30, 2013 at 1:03
  • mountable like a usb stick
    – user45171
    Oct 30, 2013 at 1:14

3 Answers 3

5

Ubuntu Touch lets you access the file system via the MTP protocol, but does not support USB Mass Storage mode. In this respect, it is similar to newer Android devices and is unlikely to change. Out of the box, you should be able to access files on the phone using any GVFS aware application.

There is a good reason why many smart devices have been moving away from mass storage mode as a way of performing file transfer: mass storage mode involves exposing a block device, while MTP exposes a file system.

Unless a file system is specially designed, only one OS should access the underlying block device at a time. FAT is not designed for this use case, which is why older Android phones that supported mass storage mode would unmount the SD card before making it available over USB.

In contrast, with MTP the phone is the only thing accessing the underlying block device, and the connected computer instead makes file system level requests over USB (e.g. list directory, download or upload a file, etc). This means you can continue to use the device while it is connected.

4
  • Hm, I see. This does seem sensible, and for the regular user it might be better. But wouldn't it be possible to keep partitons of an sd card or the internal storage? One partition that can be connected to either PC or phone and one that's expected to be mounted on the phone at all times?
    – user45171
    Oct 30, 2013 at 2:55
  • I don't think anyone is working on such a feature. The MTP support seems fairly solid though, and I haven't had problems transferring files to/from the phone through the file manager (this works a lot better in 13.10 than it did a few versions ago). It's probably better to try and do what you want with MTP. Oct 30, 2013 at 9:01
  • USB Storage mode is available on BQ Aquaris E5 with a bit of hacking. (See my answer.) I have tested the MTP file system of BQ Aquaris E5 by editing a bunch of image files via a gimp script on a MTP drive mounted to a Ubuntu 14.04 LTS computer. I tried several MTP drivers of Ubuntu 14.04 LTS for that purpose, jmtpfs seemed to be the most stable. Nevertheless, some of the pictures were lost after running the script. This does not happen with the phone mounted as usb-mass-storage to my Ubuntu 14.04 LTS computer.
    – Tobias
    Aug 8, 2015 at 9:51
  • I'm experiencing quite some instability of MTP file transfer. I'm connecting an MX4 to Kubuntu 14.04 desktops using dolphin for transfers - one machine doesn't see the device at all, on the other machine the connection breaks down after a few files have been copied. Is this typical? Aug 13, 2015 at 8:51
1

On BQ E5 Ubuntu Edition with Ubuntu Touch 15.04 (r4) I can unmount the external sdcard and switch the usb-port to mass storage mode with the script massStorage.sh and switch the usb-port back to mtp with the script mtp.sh.

Content of sript massStorage.sh:

#!/bin/sh

echo 0 > /sys/class/android_usb/android0/enable
cp /sys/class/android_usb/android0/functions /tmp/massStorageFunctions
echo mass_storage > /sys/class/android_usb/android0/functions
umount /dev/mmcblk1p1
echo /dev/mmcblk1 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file
cp /sys/devices/virtual/android_usb/android0/f_mtp/device/idVendor /tmp/massStorageVendor
cp /sys/devices/virtual/android_usb/android0/f_mtp/device/idProduct /tmp/massStorageProduct
echo 03f0 > /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idVendor
echo 5607 > /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idProduct
echo 1 > /sys/class/android_usb/android0/enable

Content of script mtp.sh:

#!/bin/sh

if [ -f /tmp/massStorageFunctions ]; then
    echo 0 > /sys/class/android_usb/android0/enable
    cp /tmp/massStorageFunctions /sys/devices/virtual/android_usb/android0/functions
    cp /tmp/massStorageVendor  /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idVendor
    cp /tmp/massStorageProduct /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idProduct
    sudo -u phablet udisksctl mount -b /dev/mmcblk1p1
    echo 1 > /sys/class/android_usb/android0/enable
fi;

Note, that the vendor and product ids are stolen from another usb-mass storage device.

I have saved these scripts in the directory ~phablet/bin. Furthermore, I have defined the following aliases for starting the scripts from the com.ubuntu.terminal command line:

alias u='sudo sh ~phablet/bin/massStorage.sh'
alias m='sudo sh ~phablet/bin/mtp.sh'

You can set these aliases in the .bashrc-file within the home directory of phablet.

Note, that you must input your pin to detach/attach the sd-card with these scripts.


Remark: One big problem with the alternative solution mtp proposed by the others is that it is not available from within cygwin. One can use mtp within windows but the mtp devices are not provided as a drive letter which is needed for cygwin. I have essentially the same use case as Tor Thommesen and found this solution to expose my secondary sd-card of the phone as mass storage device.

0

Unless a file system is specially designed, only one OS should access the underlying block device at a time. FAT is not designed for this use case, which is why older Android phones that supported mass storage mode would unmount the SD card before making it available over USB.

I don't see the point here. Yes, it should only used by one device at a time and that's why it is unmounted on the phone before it is accessible from the computer. What's the issue? Unless you want to watch a movie from the external MicroSD while you are copying files.

Also ... you don't have to use MTP very long to realize that it does not work all that well. Background processes don't sync when you expect them to. You cannot see thumbnails of your images. Transfer is slow. Another POC is pushed on users under the disguise of a a good 'user experience'. The same argument that Apple uses to completely lock everybody into their own 'ecosystem' to the point where you cannot even insert a MicroSD or change a battery on your own.

You must log in to answer this question.