Android folder backup via Rsync
Posted on 2022-05-01 23:41:00
by rainbyte
This post describes how to backup a folder from an Android phone to a PC and restore it on a 2nd phone.
Backup procedure
-
Download simplesshd on the 1st phone (play store link)
-
Open simplesshd and click
start. The log will show some relevant information:- host: something like ip 192.168.x.y
- port: default is 2222
-
Run rsync backup command on the PC. Replace
<host>and<port>with the correct values for 1st phone!rsync -auv --delete -e 'ssh -p <port>' <host>:'/sdcard/orig-dir/' '/path/to/backup-dir/'- Rsync will copy files from 1st phone
orig-dirfolder to PCbackup-dirfolder deleteremoves from PC folder the files not in the 1st phone- Note: final
/on each folder are required!
- Rsync will copy files from 1st phone
Restore procedure
-
Download simplesshd on the 2nd phone (play store link)
-
Open simplesshd and click
start. The log will show some relevant information:- host: something like ip 192.168.x.y
- port: default is 2222
-
Run rsync restore command on the PC. Replace
<host>and<port>with the correct values for 2nd phone!rsync -uv --omit-dir-times --no-perms --recursive --inplace --delete -e 'ssh -p <port>' '/path/to/backup-dir/' <host>:'/sdcard/dest-dir/'- Rsync will copy files from PC
backup-dirfolder to 2nd phonedest-dirfolder inplaceavoids double sdcard write (caused by copy and rename)no-permsis useful when perms are not supported, eg.: mtp mountsomit-dir-timesignores timestampsdeleteremoves from 2nd phone folder the files not in the PC folder- Note: final
/on each folder are required!
- Rsync will copy files from PC
Comments are not open for this post yet.