Android手机分区备份和恢复

查看boot属于哪个分区
进入手机路径dev/block/platform/ff0f0000.rksdhci/by-name输入查看命令ll。比如我这里看到的是 /dev/block/mmcblk0p5

或者使用df命令

查看boot分区的大小
输入cat proc/partitions

用dd命令将分区boot复制到data分区下
dd if=/dev/block/mmcblk0p7 of=/sdcard/boot.img bs=1024 count=32768

将备份的boot.img 拷贝到电脑
adb pull /sdcard/boot.img .

恢复boot分区内容
dd of=/dev/block/mmcblk0p5 if=/sdcard/boot.img bs=1024 count=32768

备份例子

mkdir backup
cd backup
adb shell su -c "dd if=/dev/block/bml1 of=/sdcard/boot.bin bs=4096"
adb shell su -c "dd if=/dev/block/bml2 of=/sdcard/pit.pit bs=4096"
adb shell su -c "dd if=/dev/block/stl3 of=/sdcard/efs.rfs bs=4096"
adb shell su -c "dd if=/dev/block/bml4 of=/sdcard/Sbl.bin bs=4096"
adb shell su -c "dd if=/dev/block/stl6 of=/sdcard/param.lfs bs=4096"
adb shell su -c "dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096"
adb shell su -c "dd if=/dev/block/stl9 of=/sdcard/factoryfs.rfs bs=4096"
adb shell su -c "dd if=/dev/block/stl10 of=/sdcard/dbdata.rfs bs=4096"
adb shell su -c "dd if=/dev/block/stl11 of=/sdcard/cache.rfs bs=4096"
adb shell su -c "dd if=/dev/block/bml12 of=/sdcard/modem.bin bs=4096"
adb shell su -c "tar -czvf /sdcard/data.tar.gz /data"
adb pull /sdcard/param.lfs .
adb pull /sdcard/zImage .
adb pull /sdcard/factoryfs.rfs .
adb pull /sdcard/dbdata.rfs .
adb pull /sdcard/cache.rfs .
adb pull /sdcard/modem.bin .
adb pull /sdcard/efs.rfs .
adb pull /sdcard/boot.bin .
adb pull /sdcard/Sbl.bin .
adb pull /sdcard/pit.pit .
adb pull /sdcard/data.tar.gz .
点赞