Last active
August 18, 2018 21:53
-
-
Save unqueued/a9a1138ab4b57ab7cfa0ef220143c80f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
adb shell 'umount /system || [ $? -eq 1 ]' | |
adb shell 'umount /data || [ $? -eq 1 ]' | |
adb shell mount -r /system | |
adb shell mount -r /data | |
adb shell 'stty raw; tar cpf - /system 2>/dev/null' | pv > system.tar | |
adb shell 'stty raw; tar cpf - /data 2>/dev/null' | pv > data.tar | |
adb shell umount /system | |
adb shell umount /data | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to make a full backup image of your Android device, assuming it has TWRP installed: | |
# Just copying the main block device, byte for byte | |
adb reboot recovery | |
adb pull /dev/block/mmcblk0 mmcblk0.img | |
# Or, you could make tarballs of the /system and /data partitions. | |
# You can see what the device mappings are by doing: adb shell cat /etc/fstab | |
# So, for my device, I did: | |
#!/bin/sh | |
adb shell mount -r /system | |
adb shell mount -r /data | |
adb shell 'stty raw; tar cpf - /system 2>/dev/null' | pv > system.tar | |
adb shell 'stty raw; tar cpf - /data 2>/dev/null' | pv > data.tar | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't either do adb shell 'stty raw; tar cpf - /system 2>/dev/null' | pv > system.tar, or adb shell 'stty raw; tar cpf - system | pv > system.tar, the tar will get corrupted because the it will insert at the start of the file:
tar: removing leading '/' from member names