Bash script that performs a full backup of an Android phone (connected via USB)
GPL-3.0 License
Bash script that performs a full backup of an Android phone (connected via USB). (See Limitations below.)
Based on Ryan Conrad's answer at http://android.stackexchange.com/a/28315/91564
./backup-full-android.sh <dest_dir>
Example:
./backup-full-android.sh ~/backups/phone/
If you don't see the "Success!" message at the end, then something went wrong.
On Ubuntu:
user@computer:~$ ./backup-full-android.sh /mnt/raid/bak/phones/MotoX
[+] Testing dependencies...
[+] Validating arguments...
[+] Testing for existence of destination directory...
[*] Using destination directory = /mnt/raid/bak/phones/MotoX
[*] Using temp file = /tmp/tmp.DS7agv6HzR
[+] Starting backup at Sat Mar 5 12:56:20 EST 2016 ...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Now unlock your device and confirm the backup operation.
real 23m3.877s
user 0m0.226s
sys 0m14.507s
[+] Backup concluded at Sat Mar 5 13:19:24 EST 2016
[+] Moving temp file to destination directory...
/tmp/tmp.DS7agv6HzR -> /mnt/raid/bak/phones/MotoX/20160305125620.ab
removed /tmp/tmp.DS7agv6HzR
[+] Setting output file as read-only ...
[*] Output file exists at '/mnt/raid/bak/phones/MotoX/20160305125620.ab'
-r--r----- 1 user user 3668624773 Mar 5 13:19 /mnt/raid/bak/phones/MotoX/20160305125620.ab
[+] Success!
To install necessary prerequisites on Ubuntu:
sudo apt-get install adb android-tools-adb android-tools-adbd
Please see instructions at http://android.stackexchange.com/a/28315/91564
No backup tool is perfect. This tool has been helpful for me. If used properly, I hope it's helpful for you. Unfortunately, I cannot provide any guarantees as to the completeness or soundness of this script with your phone, on your computer, in your environment. Use at your own risk.
Please, always test your backups!