3

I have two Android 4.x devices, one 4.0.2 and another 4.4.2. On both, I have installed SSHelper to push data to and from the device using rsync. It worked, but the new environment does not even have a usable rm. I would like to switch over to something that works better and possibly faster.

My next attempt was to use MTP over USB with mtpfs, but that does not work, it freezes. simple-mtpfs is not packaged for Ubuntu 13.10. KDE KIO is able to read from the device over MTP, but that does not help me at all, since I want to write my own script using rsync, and it is not able to write to it.

Then I tried sshfs, I do not get any errors mounting it, but I get IO-errors whenever I even try to cd into the mountpoint. I guess the environment with SSHelper lacks something. It does not work with HTTPS and FTPS Server either. The SFTP provided with the latter works with Filezilla, though.

So how can I get /sdcard to be mounted somewhere on my Linux machine and copy and delete files from it like I want?

7
  • 1
    You might wish to try adbfs or adb push/adb pull (see my answers here and here). I use the former for quite a while now. Mounts like a normal "drive". Should be usable for rsync, though I didn't try. Of course, adb push/pull are not really suitable for "sync", but adbfs should be :)
    – Izzy
    Commented Dec 11, 2013 at 17:13
  • adbfs does not sound bad. I guess that requires to install gigabytes of Android SDK? I just have tried to install a SFTP server on the 4.0.2 device. It works fine with Filezilla, but not with sshfs. Commented Dec 11, 2013 at 17:24
  • No, you don't need to install the entire Android SDK. You only need to apt-get install android-tools-adb. ADB itself is tiny and doesn't depend on the SDK. In turn, the only dependencies for adbfs are adb and fuse.
    – dotVezz
    Commented Dec 11, 2013 at 17:48
  • I tried adbFS and adbfs-rootless, both did not work. I wrote an email to both developers, let's see what comes around. By the way: I understand that “normal” people just use Google Drive or Dropbox and do not care about accessing the real file system, but is there no usable way to mount the /sdcard? From the Nexus 10, I cannot even get it out the device … Commented Dec 11, 2013 at 18:24
  • I can mount a few Android devices (including a Nexus 10) just fine from an Ubuntu 13.04 desktop via MTP. It worked out of the box. It might be easier asking our sister site Ask Ubuntu to help get MTP working on your desktop than trying to work around it on several Android devices.
    – Dan Hulme
    Commented Dec 11, 2013 at 18:41

1 Answer 1

6

If you want to give adbfs a try, here are some instructions. You need to take care to grab the right one, as there are two projects around: one is simply called adbfs, I couldn't get that to work correctly. The other is adbfs-rootless:

  1. go to the projects github page
  2. on that page, at the right-hand side in about the middle of the page, you find a button labeled Download ZIP. Click that to download the sources.
  3. create a new directory, e.g. mkdir ~/adbfs-rootless, and extract the .zip to it
  4. now first install the dependencies: sudo apt-get install libfuse-dev
  5. change to the directory (cd ~/adbfs-rootless), and build the binaries by simply running make
  6. copy the resulting adbfs binary into your $PATH, where your adb binary is located (for ADB, see Is there a minimal installation of ADB?)

Now you're ready to go. Another one-time job is to create a mountpoint, e.g. mkdir ~/droid. After that, connect your Android device via ADB (after having enabled USB debugging, of course). Then mount it using adb ~/droid, and do whatever you wanted to do (e.g. running rsync, copying stuff, whatever). When you're done, don't forget to disconnect: fusermount -u ~/droid.

To make things easier, I created two aliases:

alias mdroid="adb ~/droid"
alias udroid="fusermount -u ~/droid"

So I only need to type mdroid to mount, and udroid to unmount the device.

Enjoy the fun!

11
  • I did all that, however adb devices does not list any devices. It does not work with either the Nexus 10, nor with the Xperia Mini Pro. They are recognized by mtpfs, but that fails for other reasons, apparently. I have not checked whether USB debugging is enabled, though. Commented Dec 11, 2013 at 20:10
  • 1
    OK, that's not the fault of adbfs. But I might have something helpful for that as well: please see my answer here to get ADB running with Ubuntu and the Nexus :)
    – Izzy
    Commented Dec 11, 2013 at 20:20
  • 1
    Once I enabled USB debugging, this kind works on the Xperia Mini Pro with Android 4.0.2. I have yet to find out how to enable USB debugging on the Nexus 10 with Android 4.4.2. It does not really seem too stable, and rsync complains about a lot of missing functions in the file system. Commented Dec 11, 2013 at 20:23
  • I cannot help you with that, unfortunately: Neither I have a Nexus, nor Android 4.2+. I'm using that successfully with multiple devices running 2.3/4.0/4.1 (of course not simultaneously, but always only with one of them connected at a time).
    – Izzy
    Commented Dec 11, 2013 at 20:29
  • 1
    @queueoverflow, Sorry if I'm asking an obvious question or giving obvious advice, but have you enabled the "Developer Options" menu? (Go to "Settings"->"About Phone" and tap "Build number" 7 times). USB Debugging mode can be enabled from Developer Options.
    – dotVezz
    Commented Dec 11, 2013 at 20:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .