Creating a android dump file using ADB - Android Q&A, Help & Troubleshooting

Hello,
I am trying create a disk image on my windows PC of the data on my phone to see if I can recover some lost files.
On my PC, can I just use:
~# adb shell dd if=/dev/block/datapartition > data.img
or just
~# adb pull /dev/block/datapartition data.img
or do I need to use netcat and busybox to send and receive the files?
Do all these methods work exactly the same?
Thanks

just type the following on ADB
Code:
adb devices
Code:
adb shell
Code:
ls -la /dev/block/bootdevice/by-name
^ this would list all partion of your devices it should look like this
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
based on the screenshot above we know boot.img is mmcblk0p59
now we just do dd command
Code:
dd if=/dev/block/mmcblk0p59 of=/sdcard/boot.img
Congratulation you now have boot.img backup of your device :fingers-crossed::fingers-crossed:

Thanks, but will that output to the phones sd card? I would like to output the img to my pc

kaotik123 said:
Thanks, but will that output to the phones sd card? I would like to output the img to my pc
Click to expand...
Click to collapse
you are most likely do the dd command from your pc just copy the img file from your device to your pc
also on my device even it say " of=/sdcard/ " files are being drop on Internal Memory ...

ineedroot69 said:
you are most likely do the dd command from your pc just copy the img file from your device to your pc
also on my device even it say " of=/sdcard/ " files are being drop on Internal Memory ...
Click to expand...
Click to collapse
Yeah I wanted to avoid writing to the phone's memory becuase I was trying to recover lost files from it. Plus the image would be too big to fit on the remaining memory anyway. Thanks for your help but I used netcat and busybox and successfully copied the image directly to my PC. Followed the tutorial here for anyone else reading this and was quite easy: https://dfir.science/2017/04/Imaging-Android-with-root-netcat-and-dd.html (second video for windows pc).

Related

Re-partition Internal Storage (user data)

4 this kind of guys x)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Code:
Warning:
Your device will never boot :D
Does this enough?
Ok jk but consider its possible
So don't blame me,
not responsible for anything
Trick:
Read 2nd Post First
(if u think necessary)(i would)
Why ?? :
Cuz u want to increase/decrease size on internal storage/internal sd card/nand/emmc.
So u can play Asphalt 8:AirBorne
I.e. default internal storage will increase from 4.6 GB to 5.5 GB
Sounds cool ?
Go ahead
Tools required:
0. Nandorid Backup ,
back up everything every way you can/know
1. Rooted Phone
2. Custom Recovery with ADB Sideload
3. Minimal ADB and Fastboot Tools(for Computer)
4 parted utilities.zip (download from below)
5. Computer should recognise device for that install necessary drive
6. brain, commen sense, patients,calm etc.
---> PROCEDURE/STEPS
(will add screen shot, Rewrite again )
1.
Extract 'parted' from zip copy to "/system/bin"
(if can't Open Es FILE EXPLORER app> find & tape Root explorer option>mount r/w option> mount system to r/w (read/write allow)
2.
Put phone in TWRP Recovery
3.
Connect to computer
On command line interface
(Windows>Run>CMD>enter)
#commands:
adb shell
su
parted /dev/block/mmcblk0
you will see the following screen
4.
On5 re-partition
Parted command
Rm mmcblk20,21,22,23
Name ,21,22,23
Re Size command
Mkpart primary start Size end Size
Format using
Mke4fs.
Restore twrp backup
Reboot to recovery

Deleted all Bootable & Other partitions, how to connect mobile?

I wanted to upgrade from android 9 to android 10.
Adb and fastboot were installed. The phone was enabled with USB Developermode and OEM change mode.
I entered the following commands;
# adb devices (then I saw my phone)
# fastboot devices
and then
# fastboot flash boot twrp-3.4.0-0-twrp.img
After that, "something" was left on the screen in small print that could not be read .... then I pressed the power button until the image disappeared and nothing happened.
After that, the phone can no longer be connected to the computer. The computer will no longer see the phone when im enter the command
# adb devices
My phone is CUBOT P30 ...Is it possible to restore or throw it straight in the trash!
SORRY my bad english.
@IFFI76
As long as you can interact with phone's bootloader you should be able to re-flash phone's Stock ROM.
The related command sequence would be
Code:
fastboot devices
fastboot flash-all <PATH_TO_STOCK_ROM_IMAGE>
fastboot reboot
Thank you for answering!
I don't understand exactly what you mean now!?
I personally believe I can't communicate with the bootloader...
I use debian distro and this is the output of my terminal;
[email protected]:/home/iffi/Downloads/ADB-fastboot/platform-tools# adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
[email protected]:/home/iffi/Downloads/ADB-fastboot/platform-tools# adb devices
List of devices attached
[email protected]:/home/iffi/Downloads/ADB-fastboot/platform-tools#
indicates that the device list is empty!
@IFFI76
Wondering why you stubbornly want to make an ADB connection, what in your case is absolutely pointless? Check whether you can establish a Fastboot connection.
Okay, I tried to do that now
I connected the mobile phone to the computer via usb and then below is the output of my terminal.
[email protected]:~
$ cd /home/iffi/Downloads/ADB-fastboot/platform-tools/
[email protected]:~/Downloads/ADB-fastboot/platform-tools
$ fastboot devices
[email protected]:~/Downloads/ADB-fastboot/platform-tools
$ sudo su
[sudo] password for iffi:
[email protected]:/home/iffi/Downloads/ADB-fastboot/platform-tools# fastboot devices
[email protected]:/home/iffi/Downloads/ADB-fastboot/platform-tools#
Looks like I can't connect to my phone and the bootloader is DELETED!
PLATFORM-TOOLS the contents of the directory are as follows
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I suppose your phone became e-waste.

adb pull gives error "access denied" - How to fix?

All I want to achieve is to pull subfolders ( DCIM etc.pp ) of Android's /data/media folder what successfully got mounted as RW
To access /data partition you need root permission which is adb root
But most devices would refuse to run this command, in which case you need to install adb insecure mode. You can get that from here.
After installing the app switch to insecure mode. Then pull command should work.
Alternatively you can use adb shell to work around it:
Code:
adb shell
su
mkdir /sdcard/media
cp -R /data/media/* /sdcard/media
exit
exit
adb pull /sdcard/media
Notes:
The "*" in "/data/media/*" stands for all, which copies all files in current directory. If you want specific file just replace it with "filename.extension"
The option "-R" in "cp" command stands for recursive which copies directories, and will copy all files in respective directories as well.
Thanks for trying to help: Unfortunately your solutions don't work at all.
FYI:
I use /data/local/tmp for intermediate storage ( permissions: rwxrwxrwx )
I can successfully copy /data/media/<SUBFOLDER> to /data/local/tmp/<SUBFOLDER> ( permissions rw-rw-rw- )
All copied files have permission rw-rw-rw-
When applying ADB PULL on /data/local/tmp/<SUBFOLDER> I still get error "Access denied" even if having additionally set owner of all
files in /data/local/tmp/<SUBFOLDER> to shell.shell and/or root.shell and/or shell.root and/or root.root
It's working fine with me, but I used /sdcard as the copy folder.
Like I said you can only access /data partition with root. You can try the first method mentioned above.
As mentioned none of your suggestions solved the problem.
1, ADB Insecure obviously doesn't work on Android 8+ devices, hence useless
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Temporarily copying to /sdcard in my case is useless too, because /sdcard is merely a symlink to /data
So you can't even use pull command on /sdcard partition?
I only found this answer, that may be similar https://android.stackexchange.com/a/213172

General Extend WSA by 428 Linux commands

To my knowledge Windows Subsystem for Android ( WSA ) is not created to run apps from the Amazon store only, but is configured for testing via ADB, will say run Linux commands in an Android shell, too.
WSA ( what at time of this writing is running Android 12 ) has merged Landley's Toybox v0.8.4, a bag of over 200 Linux command line applets - I have not really counted them.
A typical Linux distribution provides 428 command line applets - the SU incorporated. I have uploaded .ZIP ( 263 MB ) what contains them all here to:
428-cmds
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com
If you are interested in this project, too, then it's on you to download and extract the .ZIP and push the 428 files onto Android, preferredly to /storage/emulated/0/428-cmds, and make them executable.
Example .BAT-file - assumed .ZIP got extracted into D:\428-cmds folder & ADB is installed on PC
Code:
adb connect 127.0.0.1:58526
adb devices
adb shell "cd /sdcard & mkdir -p -m06755 428-cmds 2>/dev/null"
adb push "D:\428-cmds" "/sdcard/428-cmds/"
adb shell "SM='getenforce';setenforce 0;cd /sdcard/428-cmds;CMDS='$(find .-name "*" -maxdepth 1 -type f 2>&1 | grep -i -v denied)';while read x;do chmod 06755 "$x" & chown root:shell "$x";done; << "$CMDS";chcon "$x" u:object_r:su_exec:s0;setenforce "$SM";"
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Note:
The 428 commands provided all are ELF32 binaries, so 32-bit:
That doesn't have to stop you from using them on a x86_64 PC because a 64-bit CPU can handle 32-bit commands.
Hmm... Great Work
I am getting an error on the last command.
/system/bin/sh: here document '$CMDS' unclosed
I tried the method in your toybox thread but it doesn't connect to wsa.
I think it is looking on the wrong port from the looks of the script. I am just trying to get root. I updated my rooted build of wsa and it no longer would load. i have tried different ones making sure to remove the one from the microsoft store first. Installing the one from the microsoft store by installing the amazon store gets wsa working again but without root and without my userdata.vhdx that I backed up. Any help would be appreciated. Thanks

Same adb pull command produced two files of different size?

Hi there,
The device is rooted.
I ran (on Windows)
Code:
adb shell "su -c cat /dev/block/mmcblk0p57” > 57.img
adb shell "su -c cat /dev/block/mmcblk0p57” > 57.img
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The two commands above produced respectively two files of different size, while the image file was created from the same userdata partition:
57.img 1,194,611 kb;
57-1.img 283,114 kb.
Normally, the file pulled should be like this (pulled on adb Macintosh):
How could this result be produced?
Thanks.
PS: mmcblk0p57 is the userdata partition.
What is this mmcblk0p57 partition on your device used for?
Maybe it's supposed to be that way because it's a dynamic volume.
ze7zez said:
What is this mmcblk0p57 partition on your device used for?
Maybe it's supposed to be that way because it's a dynamic volume.
Click to expand...
Click to collapse
mmcblk0p57 is userdata partition.
wenyendev said:
mmcblk0p57 is userdata partition.
Click to expand...
Click to collapse
Small size for the main userdata partition, so it is probably an auxiliary partition. Check the copy partition, which should definitely be a fixed size.
ze7zez said:
Small size for the main userdata partition, so it is probably an auxiliary partition. Check the copy partition, which should definitely be a fixed size.
Click to expand...
Click to collapse
Thanks for your reply.
But previously, adb pull was able to pull out a full userdata partition of about 53 GB out of the device...
It was on adb Macintosh.
the different size result from interrupted connection. that's why checksum is recommended. full copy of 53gb will take hours. that's why gzip compression is recommended (decrypted only).
https://forum.xda-developers.com/t/...lock-bootdevice-by-name.4535851/post-87936341
please stop posting multiple threads.
please start reading answers in old threads.
aIecxs said:
the different size result from interrupted connection. that's why checksum is recommended. full copy of 53gb will take hours. that's why gzip compression is recommended (decrypted only).
https://forum.xda-developers.com/t/...lock-bootdevice-by-name.4535851/post-87936341
please stop posting multiple threads.
please start reading answers in old threads.
Click to expand...
Click to collapse
Thanks.
But the later part of your answer "
that's why gzip compression is recommended (decrypted only).
https://forum.xda-developers.com/t/...lock-bootdevice-by-name.4535851/post-87936341
please stop posting multiple threads.
please start reading answers in old threads." was simply irrelevant to the question.
Thanks for being relevant.

Categories

Resources