A quick note to self to remind how I do backups of my Android device with rsync (and adb).
I have followed this guide: How to use rsync over USB on Android with adb
My personal notes:
- I have Lineage so I have rsync in my Android device already installed
- I run Debian stable (buster, for now) on my laptop, with adb installed
- My /sdcard/rsyncd.conf file:
address = 127.0.0.1
port = 1873
uid = 0
gid = 0
path = /
use chroot = false
read only = false'
- Start port forwarding by running:
adb forward tcp:6010 tcp:1873
- The command:
adb shell /data/local/tmp/rsync --daemon --no-detach --config=/sdcard/rsyncd.conf --log-file=/proc/self/fd/2
didn’t work, produced this message: “@ERROR: protocol startup error” so I ended up doing:
rsync --daemon --no-detach --config=/sdcard/rsyncd.conf --log-file=/sdcard/rsync.log
and opened another tab to perform the rsync commands from my laptop:
rsync -av --progress --stats rsync://localhost:6010/root/storage .
rsync -av --progress --stats rsync://localhost:6010/root/data .
Then I saw that rsync was copying the symlinks instead of their contents: /storage/self/primary was a broken link to /mnt/user/0/primary
So I ran again the commands with -LK:
rsync -av --progress --stats -LK rsync://localhost:6010/root/storage .
rsync -av --progress --stats -LK rsync://localhost:6010/root/data .
and now I have a copy of all the files I’m interested. In addition to this, I run an adb backup of the system:
adb backup -f ./adb_backup_apk_shared_all_system.ad -apk -shared -all -system
and I think that’s all that I need for the case I want to remove stuff from my phone or some disaster happens.