How can I connect to my android device to rsync music (or other stuff)?

  • I recommend editing this to explain exactly what action produced that error message. (For example, if it's the output of a command, you could include the full command.) – Eliah Kagan Sep 9 '13 at 20:39
  • 1
    maybe interesting: Syncopoli – DJCrashdummy Aug 1 at 0:19
  • @DJCrashdummy if you write your comment as answer, I will up-vote it. – guettli Aug 1 at 7:26
  • @guettli i wrote this only as comment, because Syncopoli is just a rsync-client (for now). – DJCrashdummy Aug 21 at 15:54
up vote 34 down vote accepted

Using sshelper

I found this solution:

  • Install sshelper on the device (no rooted device needed, available from google play market)
  • In my WLAN the device is called "android". But you can use the IP, if you can't give the device a hostname.

Edit local ssh-config, to alter the default port for host "android"

host android
    Port 2222
  • Start sshelper on device.
  • Connect android device to you WLAN.

rsync -rvlc Music android:SDCardLink/

Update I prefere -rvlc to -a since you get a lot of warnings since setting permissions and time-stamps does not work. The option -c makes the second sync much faster.

Unfortunately it needs some time for music apps to see the new files. Restarting the device helps.

  • 12
    An alternate way to use rsync with SSHelper without having to modify .ssh/config: rsync -avz -e 'ssh -p 2222' Music android:SDCardLink/ ( – bmaupin Jan 20 '14 at 4:08
  • 1
    @guettli what for -c checksum option to syncing music files ? this can slow down significantly – EdiD Feb 14 '16 at 14:32
  • 4
    @guettli from rsync man : -c, --checksum. Without this option, rsync uses a "quick check" that (by default) checks if each file’s size and time of last modification match between the sender and receiver. This option changes this to compare a 128-bit checksum for each file that has a matching size. Generating the checksum means that both sides will expend a lot of disk I/O reading all the data in the files in the transfer, so this can slow things down significantly. – EdiD Feb 23 '16 at 8:21
  • 3
    @guettli I guess that --size-only would be the fastest solution. However it's not so save as -c – niels Dec 22 '16 at 19:51
  • 1
    I used USB tethering and got much faster transfers. The following command worked for me after I ran SSHelp and it showing IP which might be different everytime: rsync -avzhP --inplace --info=progress2 -e 'ssh -p 2222' /home/username/path/to/pics/ – Organic Addict Dec 25 '16 at 12:03

Actually using rsync over MTP/usb

It's easier than everyone is saying, first notice that when GVFS mounts the MTP mount it'll be available under. You can force this by opening the phone up in a graphical file-browser (thunar/nautilus/etc)


go in there. Assuming you have one mtp device, this should work:

$ cd /run/user/$UID/gvfs/mtp*

Find where you want to transfer the files too, and then rsync them to it

$ cd SanDisk\ SD\ card/Movies/

$ pwd # prints "/run/user/1000/gvfs/mtp:host=%5Busb%3A003%2C096%5D/SanDisk SD card/Movies"

$ rsync --verbose --progress --omit-dir-times --no-perms --recursive --inplace ~/Videos/ ./

Rsync options

  • --inplace: I highly suggest using --inplace without which mtp may want to copy the file a new, and then rename it to the old one. That may result in copying the file to the SD card twice: once for the mtp transfer to the SD card, and another time because the MTP driver may not support (mv), it may (cp/rm) under the hood to be safe.
  • read man rsync for a description of --verbose, --progress, --recursive but they're pretty self-documenting.
  • --omit-dir-times --no-perms are required because mtp doesn't support that.
  • 2
    I add the following options --omit-dir-times --no-perms --ignore-existing. Rsync fails to set directory timestamps over MTP. I'm pretty sure that "no permissions" is the default, but I like to specify it. Ignoring existing files allows it to pick up where it left off. – Stephen Ostermiller Jul 6 '16 at 12:21
  • 4
    Why --ignore-existing? That's just losing redundancy. You could always --size-only which reduces the sync to the directory listing and not checksums. I'm going to add the --omit-dir-times and --no-perms because that sounds useful, and I seem to recall getting an error at the end about that. – Evan Carroll Jul 6 '16 at 17:41
  • Rsync has problems setting time stamps over MTP properly for me, so without --ignore-existing it tries to sync all the files. I like your --size-only suggestion. I'll try that instead next time. – Stephen Ostermiller Jul 6 '16 at 17:43
  • 3
    I also use put the trailing slash on the destination so I don't have to use a star on the source: ~/Videos/ ./ – Stephen Ostermiller Jul 6 '16 at 17:46
  • I also had to add '--delete-after' to get it to delete files I'd already removed from the music folder on the computer. So the full command is: rsync --verbose --progress --omit-dir-times --no-perms --recursive --inplace --ignore-existing --delete-after /home/user/MUSIC/ . – happyskeptic Aug 3 '16 at 10:25

rsync backup for Android can be configured to sync in reverse, that is from a Linux host to Android device.

And with the help from Llama one can configure the Android device to rsync automatically on specific conditions, e.g.:

  1. at 5 am,
  2. when the phone is connected to a specific Wi-Fi, and
  3. when it is charging.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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