Last active
December 26, 2025 18:46
-
-
Save veygax/95883d6487f626cbbb5408ca71e2c8ee to your computer and use it in GitHub Desktop.
dump partitions from an Android device (excluding userdata)
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/bash | |
| VERSION=$(adb shell getprop ro.build.version.incremental | tr -d '\r\n') | |
| TIMESTAMP=$(date +%Y%m%d_%H%M%S) | |
| FOLDER="dump_${VERSION}_${TIMESTAMP}" | |
| START_TIME=$SECONDS | |
| mkdir -p "$FOLDER" | |
| cd "$FOLDER" | |
| echo "dumping to: $FOLDER" | |
| adb root | |
| sleep 2 | |
| for part in $(adb shell "ls /dev/block/bootdevice/by-name/" | tr -d '\r'); do | |
| if [[ "$part" != "userdata" ]]; then | |
| echo "Pulling $part..." | |
| adb exec-out "su -c 'dd if=/dev/block/bootdevice/by-name/$part bs=4096 2>/dev/null'" > "$part.img" | |
| fi | |
| done | |
| cd .. | |
| ELAPSED_TIME=$(($SECONDS - $START_TIME)) | |
| echo "dumped $VERSION to $FOLDER. took $(($ELAPSED_TIME / 60)) minutes and $(($ELAPSED_TIME % 60)) seconds." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment