Synchronizing large amounts of music to an Android phone

I am a strange person that likes to have local copies of my music. I occasionally find myself driving in rural areas without a cell signal, or on a flight where I don’t want to pay the wifi charge, or on a primitive subway (like in New York) where the tunnels have no reception1.

Previously in these situations I’d use a portable mp3 player, the late great Sansa Fuze, and that was good enough. But recently my Fuze bit the dust. Since nobody sells mp3 players anymore2 I have to put all my music on my phone. Copying a bunch of files is simple enough, but I sometimes acquire new music and I want a braindead way to update the music on the phone, preferably with rsync. Unfortunately this turned out to be Hard.

First failed attempt: rsync over MTP

I tried to do the most obvious thing first: connect the phone with USB and rsync from the source to the destination. This does not work well at all. Modern phones connect to computers using MTP, or Media Transfer Protocol, which is designed for extremely simple file listing, copying, moving, and deleting. It doesn’t like random reads and it doesn’t handle partial writes. Over MTP, rsync goes intolerably slow as it tries to figure out which files to copy. I tried setting various parameters on rsync to adapt for this, but nothing worked. Fail.

Second failed attempt: FolderSync from Drive to the phone

The second idea was suggested to me by a coworker. I already have all my music on Google Drive, so he suggested I try using the FolderSync app to sync from Drive to my phone. This sort of worked, but after 300 or so files the process would stall, and then halt. I had to cancel the process and start it over again — at least it was smart enough to pick up where it left off. But after doing that five times I gave up. Also, FolderSync and rsync have different ideas about which files were new. FolderSync was recopying files that were already on the destination and I couldn’t configure it to only look at, for example, the file size when determining which files to copy. Fail.

Third mostly failed attempt: rsync and SSHelper

My third idea was to use SSHelper, a neat little Android app that opens up an ssh server on your phone. I would use rsync, like I wanted to, but it would transfer over the network instead of USB. This worked, but transferring the initial 50 gigs of data over the network was going much too slowly. By this point I’d spent two days trying to get my music on my gotdamn phone and was not feeling patient.

Solution: MTP, then rsync and SSHelper

The idea that worked was to use MTP for what it’s meant for: dumping the music folder wholesale from my computer to the phone over USB. Connect phone, drag and drop music onto phone, wait. Now that I’ve seeded my phone with the initial payload, I can use SSHelper and rsync to update the phone with just the new tracks. Listing and comparing files is plenty fast with SSHelper, and copying whatever few files I updated goes quickly enough over wifi.

There you have it! I do miss the days of just loading up a micro SD card and popping it in the phone, but this solution works perfectly well for my needs.

  1. Please refrain from commenting about how you stream all your music over the internet, and get off my lawn []
  2. and I can’t use an ipod []
Share