Skip to content

Instantly share code, notes, and snippets.

@caplio
Last active December 12, 2015 08:48
Show Gist options
  • Save caplio/4746395 to your computer and use it in GitHub Desktop.
Save caplio/4746395 to your computer and use it in GitHub Desktop.
#!/bin/sh
#############################################
#
# usage : dd.sh <number of pertitions>
#
# ex) $ dd.sh 38
#
#############################################
# start count
c=0
# end count
n=$1
# output dir
output=/mnt/sdcard/ext_sd/images
if [ $# -eq 0 ]
then
echo "set count number"
else
adb shell mkdir $output
while [ $n -ge $c ]
do
echo "start dd to image `date`"
echo "if=/dev/block/mmcblk0p$c of=$output/mmcblk0p$c.img"
adb shell "su -c dd if=/dev/block/mmcblk0p$c of=$output/mmcblk0p$c.img bs=2048"
c=`expr $c + 1`
echo " end -----------------"
done
echo ""
echo "downloading dd image from $output"
adb pull $output/
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment