[GUIDE] Making Dump Files Out of Android Device Partitions

Use:
The main purpose is to make a file that contains all data in android specific partition. This is really handy in case of dumping leak firmwares.

Pr-requirement:
- Rooted device.
- Knowledge of how to use adb or Terminal Emulator.

The first step of making dump files out of device partitions is to locate its mounting points..!!
So in our tutorial, we will make it in 2 sections. Section 1 for how to get mounting points, and section 2 for how to get partition dumped..
Keep in mind that this is xda-university; so my target is to show beginners how to do that manually, without the aid of any tool, so they can get the concept behind it.. OK let's begin..!!

Section 1:
Getting mounting points

There are several methods to achieve this, but we will discuss the easiest methods that give efficient information about the partition that you want to know its mounting point.
All these methods will be described using adb shell.

Way #1

Code:

adb shell
cat /proc/partitions

This one needs from you to figure out which block belong to which partition name.!!

Way #2

Code:

adb shell
ls -al /dev/block/platform/dw_mmc/by-name

This one will give you info about the dev block names WITH their familiar names (i.e, boot, recovery, system... etc)

This command is not universal between devices, and you will need to gather its pieces (/dev/block/platform/dw_mmc/by-name).How?
- In your device, use any explorer that can get you to the device root (personally I use ES Explorer, by pressing on "/" on navigation bar).
- Go to "/dev/block/platform/" folder
- Here you will see some files and folders, we need to open folders and search for the folder called "by-name" inside one of them; in my situation it was "dw_mmc" folder which has the folder "by-name" inside it.
- At the end, my targeted piece info will be (/dev/block/platform/dw_mmc/by-name)
- Now open adb shell and put that command..

Way #3
By pushing parted binary to /system/bin folder and run it (you can find it in attachment).

Here, your mounting points will start with /dev/block/mmcblk0p* where (*) is the number shown in the table above for each partition.
example:
The hidden partition mounting point will be mmcblk0p10
The radio partition mounting point will be mmcblk0p7
The system partition mounting point will be mmcblk0p9
The recovery partition mounting point will be mmcblk0p6

to know what is the initial name for your device partition.. In the example above, it was mmcblk0.

- Also to be able to do adb push to /system partition for parted binary, you will need insecure boot.img used in your ROM or adbd insecure installed in your device (Check this thread for that app), or just push parted binary manually by any root explorer and then fix permissions to rwxr-xr-x (755).

***

Section 2:
Dumping ROM partition

After locating the mounting point of the partition you want to dump, open adb shell command prompt and type:

Let's say I want to take a dump out of system partition from above example. So the adb commands will be:

Code:

adb shell
su
dd if=/dev/block/mmcblk0p9 of=/sdcard/system.img

This may take a while to complete the dumping process, depending on the size of your dumped partition; so be patient..

Note:
If the partition is formatted as ext3/4 then the dumped partition will have .img as an extension.
Other partition dumps have different extensions; examples:

radio.bin

param.lfs

Sbl.bin

zImage (without extension)

***

Optional:
Read Partition Image

After dumping an image from android partition, you can mount it to extract a particular file for sharing, or the whole dump content in case the ROM chief wants to make a ROM out of dump files..For Linux Users:
- Open terminal and type:

For Windows Users:
- Download LinuxReader from this site here.
- Open it -> Drives -> Mount Image -> Then choose your dumped image and hit Mount. A new driver will appear that contains all files inside the dumped image called "Linux native Volume 1". Just double click it to get inside the dumped image.

In this post, I will try to explain the use of each binary used in the tutorial, so you can make sense of each action taken.

Quote:

#1

Code:

adb shell

Run remote shell interactively, as if you are in linux terminal.

Quote:

#2

Code:

cat /proc/partitions

cat binary is used to concatenate file(s) and print them to standard output display. In our example, it prints the content of partitions file which is found in proc folder to screen display.

Quote:

#3

Code:

ls -al /dev/block/platform/dw_mmc/by-name

ls binary is used to list directory contents.-al is the used option for ls which means to include entries that started with "." in long listing format. There are a lot of options for ls binary. You can always print ls --h to display help menu for other options available.

Quote:

#4

Code:

adb remount

Remounts the /system partition on the device read / write. This has been disabled in some devices (those with secure boot image); so you need to make sure that you have patched adbd that can run this command effectively.

Quote:

#5

Code:

su

Used to get super-user privilege.

Quote:

#6

Code:

mount -o remount,rw /system

Specific command to mount the /system partition on the device read / write (rw).
If you change rw to ro, you will get /system partition mounted as read only.

Quote:

#7

Code:

adb push parted /system/bin/parted

adb push is used to copy file/dir from your local computer to android device. The usual format is adb push <local> <remote>

Quote:

#8

Code:

chmod 0755 /system/bin/parted

chmod binary is used to set permissions for the specified file/dir.
The number after chmod is the permission used. See the next box for better understanding of chmod formatting:

As you can see, if you said 0755, it will be as same as saying ---rwxr-xr-x

Quote:

#9

Code:

dd if=/dev/block/mmcblk0p9 of=/sdcard/system.img

dd binary is used to copy a file with converting and formatting.if means input file; here we pointed to the whole partition, not specific file.of means outputting file to specific destination path; here it is to sdcard with system.img name.

Quote:

#10

Code:

mkdir -p /mnt/disk

mkdir binary is used to make folder dir.-p is mkdir option which means to create folder with sub-folder at the same time. Here we want to create mnt folder that contains disk sub-folder in it. If the folder and or sub-folder(s) are already exists, it will not give error but nothing will be created.

Quote:

#11

Code:

mount -o loop yourImage.img /mnt/disk

This is linux way to mount images into specific directory (/mnt/disk in this example).

Quote:

#12

Code:

cd /mnt/disk

cd used to get inside specific dir path.

Quote:

#13

Code:

ls -l

ls binary is used to list directory contents as described above.-l is the used option for ls which means to list contents in long listing format.

can i able to mount boot.img in android itself...actually i wanted to extract boot.img frm mobile without any tools or without the help of PC...if there be any possibilities..??

if you mean extract to modify boot.img, then I don't think there is away to do that from device itself in the moment..
if you mean dumping boot.img then yes you can, just install terminal emulator from Google play and you can run adb shell commands directly from the device

Great guide hopefully makes it easier for us to get dumps! if you add logcats etc, i find they have trouble executing "adb logcat >> log.txt" -.-
also you should teach them the easy tar method, so while booted "tar -c /system/* >> /sdcard/system.tar" or via adb shell

Great guide hopefully makes it easier for us to get dumps! if you add logcats etc, i find they have trouble executing "adb logcat >> log.txt" -.-
also you should teach them the easy tar method, so while booted "tar -c /system/* >> /sdcard/system.tar" or via adb shell

Yup that is possible and easy to extract but it is only for partitions that is shown in android os,,, you can't use it for boot.img, sbl.bin, modem.bin...etc right

Yup that is possible and easy to extract but it is only for partitions that is shown in android os,,, you can't use it for boot.img, sbl.bin, modem.bin...etc right

ofcoarse, i actually had a project going where it detects all partitions(modems, boot.img, system etc..) that archives itself into a .zip
it was going well until i did something in the script, now it only works on the s3 it shall be continued one day!

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality.Are you a developer? | Terms of Service