8

NOTE: I asked a similar question here several days ago, but I was told to re-post it to "Stack Exchange Software Recommendations", which I did. Now, I posted this current question to "Stack Exchange Software Recommendations", but I was told to re-post it here. I hope this current question indeed will now be accepted here.

I know that I can use adb from my desktop computer to take a backup of my sdcard ...

adb pull /sdcard/ .

This downloads everything from my sdcard to the specified directory on my desktop machine. However, I'm wondering if there is some way to download in an rsync-like manner: i.e., only downloading and updating files that have actually changed between my device's sdcard and the directory on the desktop machine.

Or is there perhaps a non-adb-based way to do this?

Also, I want to initiate this from the desktop machine, not the Android device.

Any ideas?

PS: This is an Android-10 device, a OnePlus 7Pro (GM-1917) running OOS 10.3.2. However, the answer to my question is probably unrelated to that, since it has to do more with adb than the android device itself.

Thanks in advance.

0

3 Answers 3

5

Per the comment by alecxs, above, adb-sync gives me the functionality I'm looking for: https://github.com/google/adb-sync

Some day I'll also try Adebar.

Thanks to alecxs!

2

I tried the original adb-sync (https://github.com/google/adb-sync), but I couldn't get it to work due to an encoding error. The better-adb-sync fork (https://github.com/SelfAdjointOperator/better-adb-sync/) worked well, though.

Just note that the command line options are a bit different from the original, e.g. when you want to pull files from the phone (and not copy to the phone from your PC), you should use --pull instead of --reverse.

3
  • it's unclear if either of these does differential transfers, i.e. if I have a 10GB database file and one record is added at the end, is it going to only transfer the block(s) that changed? Or is it just mimicing rsync in terms of knowing which files changed?
    – Michael
    Commented Oct 30, 2022 at 23:09
  • the reason I ask is I use rsync for this (via sshelper on my phone) but too frequently rsync "hangs" in the middle of the transfer for no discernable reason.
    – Michael
    Commented Oct 30, 2022 at 23:10
  • 1
    The better-adb-sync fork is now the official recomendation. adb-sync is deprecated and it's readme provides the link: github.com/jb2170/better-adb-sync Commented Jan 1 at 23:52
1

Run SimpleSSHD https://f-droid.org/en/packages/org.galexander.sshd/ and use rsync like you would with any other ssh-enabled server.

rsync -r -e 'ssh -p 2222' --info=progress2 [email protected]:/storage/emulated/0 ~/backup/sdcard

It's not exactly "over adb" but you could enable USB tethering on the phone and use the corresponding phone IP address to get a good transfer speed.

2

You must log in to answer this question.

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