"dd" versus "adb pull"? - Android Q&A, Help & Troubleshooting

Hi there,
I tried both dd and adb pull to extract userdata partition (mmcblk0p57) from device.
The results were different.
For dd
Code:
adb shell dd if=/dev/block/mmcblk0p57 of=data.img
it returned
Code:
dd: data.img: Read-only file system
For adb pull, it created a NDIF disk image of userdata partition.
Why dd command failed?
What would be the differences between ddand adb pull commands?
Thanks in advance.

cross-posted
https://forum.xda-developers.com/t/4132813/post-87922879

Related

Extracting Rogers images

I'm trying to extract boot, recovery, system from my Rogers Notes, and need some clarification. Do I need to be rooted first? When I try now, I cannot access /dev/block to extract any image.
It seems all the root methods available somehow modifies the kernel or recovery or system, which kinda makes it impossible to extract stock images?
Help please
I have used adb to shell into the Note and extracted the various images. I'm looking for stock Rogers images. The ones DAGr8 posted still has the Telus brand on them.
c:\> adb shell
$ su
# dd if=/dev/block/mmcblk0p24 of=/sdcard/system.img
# dd if=/dev/block/mmcblk0p22 of=/sdcard/recovery.img
# dd if=/dev/block/mmcblk0p8 of=/sdcard/boot.img
# exit
c:\> adb pull /sdcard/system.img
c:\> adb pull /sdcard/recovery.img
c:\> adb pull /sdcard/boot.img
ha! i'm on the boat, i'm trying to extract all the original stuff before going crazy on it
just a few min ago i PMed DAGr8 for details
seems like you beat him to it
i know the radio was already done
so i'll just do those 3 mentioned above
firefly9 said:
c:\> adb shell
$ su
# dd if=/dev/block/mmcblk0p24 of=/sdcard/system.img
# dd if=/dev/block/mmcblk0p22 of=/sdcard/recovery.img
# dd if=/dev/block/mmcblk0p8 of=/sdcard/boot.img
# exit
c:\> adb pull /sdcard/system.img
c:\> adb pull /sdcard/recovery.img
c:\> adb pull /sdcard/boot.img
Click to expand...
Click to collapse
firefly9 said:
I have used adb to shell into the Note and extracted the various images. I'm looking for stock Rogers images. The ones DAGr8 posted still has the Telus brand on them.
c:\> adb shell
$ su
# dd if=/dev/block/mmcblk0p24 of=/sdcard/system.img
# dd if=/dev/block/mmcblk0p22 of=/sdcard/recovery.img
# dd if=/dev/block/mmcblk0p8 of=/sdcard/boot.img
# exit
c:\> adb pull /sdcard/system.img
c:\> adb pull /sdcard/recovery.img
c:\> adb pull /sdcard/boot.img
Click to expand...
Click to collapse
Once I get adb running do I just input the above commands into the command prompt?
Does the "adb pull" command just copy the images from the device or does it remove them?
Sorry for the basic adb questions. I've always had Nexus phones so I'm not sure if things work differently on other phones.
Once in the shell on the device, denoted by the "$" prompt, enter the commands outlined. After the "dd" commands have been completed, enter "exit" (twice, actually) and then the "adb pull" commands to copy the images from the device to you local computer. The images are copied so they will remain on the device until you delete them.
i find this easier...
adb shell dd if=/dev/block/mmcblk0p13 of=/sdcard/amss.bin
adb shell dd if=/dev/block/mmcblk0p17 of=/sdcard/mdm.bin
adb shell dd if=/dev/block/mmcblk0p24 of=/sdcard/system.img
adb shell dd if=/dev/block/mmcblk0p22 of=/sdcard/recovery.img
adb shell dd if=/dev/block/mmcblk0p8 of=/sdcard/boot.img
adb pull /sdcard/amss.bin
adb pull /sdcard/mdm.bin
adb pull /sdcard/system.img
adb pull /sdcard/recovery.img
adb pull /sdcard/boot.img

[Q] Read partitions without rooting

I'm trying to find an universal way to read userdata partition(dump partition) without rooting the device.
Assumption :
the device can be boot in fastboot mode
Possible ways :
1. Using fastboot
I've looked into fastboot.c, it taking usb as a usb_handle pointer. I'm trying to move from that point. Fastboot is mostly to write or erase, but I assumed if writing and erasing are possible, reading should be possible as well.
2. Using nvflash, tftp...
It won't be the solution, since it's chip dependent but using chip vendor's download tool to dump partitions.
Go for it!
How does using adb dumping from /dev/mmcblk0p1 sounds?
can I unmount mmcblk0p1, and mount back to readable position?
what device? more info please.
dd if=dev/mmcblk0p? of=data.img bs= 8096 is usually the easiest. (<--just an example)
also this may be helpful:
http://forum.xda-developers.com/showthread.php?t=1247908
chrisrotolo said:
what device? more info please.
dd if=dev/mmcblk0p? of=data.img bs= 8096 is usually the easiest. (<--just an example)
also this may be helpful:
http://forum.xda-developers.com/showthread.php?t=1247908
Click to expand...
Click to collapse
Thanks for the link. using dd command is the exact way I used to dump mmc block as root. Or can it be run under not-rooted phones?
Rooting depends on the kernel version of devices, so when I have to dump various phones, it's very cumbersome to root different kinds of devices and dump.
So I'm finding a way to walk around the problem by using fastboot or if possible adb.
I think fastboot is my best bet so far.
How about adb?
adb shell
df -h
kkiqq1208 said:
How about adb?
adb shell
df -h
Click to expand...
Click to collapse
df -h will only show usage of storage medias. Is there anyway I can read off the actual data?
As already mentioned, dd, but via ADB. I believe that it functions at a low enough level that you should be able to dump mmcblk0 without having to be rooted. If dd can't be directly accessed via adb, you could extract a busybox install from a rooted phone and set it up in your adb directory and then run it from there with busybox (in theory).
Волк said:
As already mentioned, dd, but via ADB. I believe that it functions at a low enough level that you should be able to dump mmcblk0 without having to be rooted. If dd can't be directly accessed via adb, you could extract a busybox install from a rooted phone and set it up in your adb directory and then run it from there with busybox (in theory).
Click to expand...
Click to collapse
Question.
Feels like i'm on the different page from you. If i run dd for /dev/mmcblk0 it does give me an error message saying "Access Denied" of couse mmcblk0 is owned by root. And busybox too(I haven;t tried this), it's just a set of linux commnads, I'm not sure how it can access a file(in this case, a device) which does not have its ownership.
Please correct me if I'm wrong.
Hi All,
There is a way to dump any partition to SD card partition on unrooted device vi ADB.
Paste this couple of lines into the terminal :
adb kill-server
adb wait-for-device
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
adb reboot
adb wait-for-device
adb shell "mount -wo remount rootfs /"
adb shell "rm /data/local.prop"
adb shell dd if=/dev/block/mmcblk0p1 of=/sdcard/mmcp1.dump
The phone may reboot many time after that, so make sure the file /data/local.prop is deleted after this operation. or execute this :
adb reboot
adb wait-for-device
adb shell "rm /data/local.prop"
adb reboot
hope that helps
__________________
HTC One X (SFR)
Wissam said:
Hi All,
There is a way to dump any partition to SD card partition on unrooted device vi ADB.
Paste this couple of lines into the terminal :
adb kill-server
adb wait-for-device
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
adb reboot
adb wait-for-device
adb shell "mount -wo remount rootfs /"
adb shell "rm /data/local.prop"
adb shell dd if=/dev/block/mmcblk0p1 of=/sdcard/mmcp1.dump
The phone may reboot many time after that, so make sure the file /data/local.prop is deleted after this operation. or execute this :
adb reboot
adb wait-for-device
adb shell "rm /data/local.prop"
adb reboot
hope that helps
__________________
HTC One X (SFR)
Click to expand...
Click to collapse
Has anyone verified if this works for reading partitions on a non-rooted phone?
This doesn't work on an unrooted, locked device.
Code:
C:\Windows\System32>adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
/system/bin/sh: can't create /data/local.prop: Permission denied
This did not work for my phone.
I got "permission denied" right after
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
Most of the above will only work on a rooted device with superuser.
The loop holes for shadow copies are mostly fixed since 6.0.
Partitions that can be accessed without root can be dumped with DD through ADB if ADB itself is supported and not internally limited to prevent just this.
Try
Code:
adb reboot recovery
adb root
adb shell
In my device, I can able to read those /data /dev without bootloader unlocking or root.
HemanthJabalpuri said:
Try
Code:
adb reboot recovery
adb root
adb shell
In my device, I can able to read those /data /dev without bootloader unlocking or root.
Click to expand...
Click to collapse
So, ... You are lucky. If I try these commands, I am getting "error: closed". And believe it or not, I have my bootloader UNlocked. It's a doomed chinese tablet, Allwinner 100 SOC.
observingman said:
So, ... You are lucky. If I try these commands, I am getting "error: closed". And believe it or not, I have my bootloader UNlocked. It's a doomed chinese tablet, Allwinner 100 SOC.
Click to expand...
Click to collapse
I found that it is common for many Realme devices to able to use `adb root` in recovery mode.
I have a Realme C12 which has Mediatek Helio G35 MT6765G SoC. So we can also able to `readback` partitions by using SP Flash Tool with the help of MTK-bypass.

Backup all partitions including EFS

For those who do not know, EFS partition containing IMEI, MEID, and other important data. Once lost, these partitions can not be recovered, because they are unique to your phone only.
Since we do not have a custom recovery yet, the only solutions to backup EFS partitions are in terminal or adb. I prefer adb because it is more easier to do.
1.Create a folder in internal sdcard named efs
2.Run these commands in adb or terminal
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst1 of=/sdcard/efs/modemst1.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst2 of=/sdcard/efs/modemst2.img
3.If you want to backup all partitions on your phone create a folder named backup in internal sdcard can run these commands:
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/sdcard/backup/aboot.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/backup/boot.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/DDR of=/sdcard/backup/DDR.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/encrypt of=/sdcard/backup/encrypt.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/fota of=/sdcard/backup/fota.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/fsc of=/sdcard/backup/fsc.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/fsg of=/sdcard/backup/fsg.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/laf of=/sdcard/backup/laf.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/misc of=/sdcard/backup/misc.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/mpt of=/sdcard/backup/mpt.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/persist of=/sdcard/backup/persist.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/rct of=/sdcard/backup/rct.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=/sdcard/backup/recovery.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/rpm of=/sdcard/backup/rpm.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sbl1 of=/sdcard/backup/sbl1.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sns of=/sdcard/backup/sns.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/ssd of=/sdcard/backup/ssd.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/tz of=/sdcard/backup/tz.img
Less important partitions:
dd if=/dev/block/platform/msm_sdcc.1/by-name/abootb of=/sdcard/backup/abootb.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/cust of=/sdcard/backup/cust.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/drm of=/sdcard/backup/drm.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/eksst of=/sdcard/backup/eksst.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/factory of=/sdcard/backup/factory.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/grow of=/sdcard/backup/grow.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modem of=/sdcard/backup/modem.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/pad of=/sdcard/backup/pad.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/rpmb of=/sdcard/backup/rpmb.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sbl1b of=/sdcard/backup/sbl1b.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sdi of=/sdcard/backup/sdi.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/tzb of=/sdcard/backup/tzb.img
For dd commands your phone has to be rooted.
Please do not ask me how to install and use adb.
If you want to restore your original EFS partitions just run the commands below in adb ot terminal:
dd if=/sdcard/efs/modemst1.img of=/dev/block/platform/msm_sdcc.1/by-name/modemst1
dd if=/sdcard/efs/modemst2.img of=/dev/block/platform/msm_sdcc.1/by-name/modemst2
You'll have to type that whole thing out, and be VERY careful with spaces and punctuation. One wrong letter and you could hard brick your phone.
Very nice work.
I thought that EFS is only used by Samsung. Guess not.
Sent from my D620R [Stock 4.4.2]

img a research on Alcatel 6034 or 6035R

Hello,
I am looking for a mmcblk0p3 file located in the phones to redo the update.
to check the score of the phone:
Code:
adb shell cat proc/partitions
here is the code to extract the file in the SD card:
Code:
adb shell su -c dd if=/dev/block/mmcblk0p3 of=/sdcard/ids.img bs=4096
I tried but the problem my phone not recognize sd card as there is always block the startup logo.
here is the second code to extract the file on pc:
Code:
adb -d shell su -c busybox dd if=/dev/block/mmcblk0p3 > C:\Users\%username%\Desktop\ids.img
when I install a ROM by accident I mmcblk0p3 erase the file is replaced with the boot file.
I try again to do the update but I have a problem because it marks me "failure reading device information. Check the condition of the phone"
I'm looking to remake mmcblk0p3 updating the phone.
there is there anyone who could share that file (1024 kb) => traceability?
Thank you for your reply.

Asus Zenfone Max M2 - Need ABOOT image

Hi!
Who can provid me ABOOT image, please!?
with root:
download terminal emulator and type:
Code:
shell su
dd if=/dev/block/mmcblk0p23 of=/storage/emulated/0/ABOOT.img bs=4096
Then use ADB and type:
Code:
adb pull /storage/emulated/0/ABOOT.img %cd%
It will pull aboot.img to your adb folder
Or in TWRP:
Use ADB and type:
Code:
adb shell "/dev/block/mmcblk0p23 of=/sdcard/ABOOT.img bs=4096"
Then use ADB and type:
Code:
adb pull /sdcard/ABOOT.img %cd%
It will pull aboot.img to your adb folder
Then upload please.
Thanks!

Categories

Resources