How to make an Android partition image on your PC

I'm trying to make a backup (direct dd image of the partitions of my built-in memory card of my phone to my computer. I use Linux and my phone is Nexus 4.

+5
source share
5 answers

Here is another best answer:

Requirements: adb must already be installed

  • Download the unsafe boot.img to your computer from https://www.androidfilehost.com/?fid=9390169635556426389
  • Restart your phone to fast boot mode by turning it off and then pressing and holding the volume down and power down buttons.
  • From your Linux PC, in the folder where boot.img is located, type:

    $ fastboot boot boot.img 
  • To copy a section type image mmcblk0:

     $ adb pull /dev/block/mmcblk0 mmcblk0.img 
+3
source

Requirements: adb must already be installed

  • Download the unsafe boot.img to your computer from https://www.androidfilehost.com/?fid=9390169635556426389
  • Restart your phone to fast boot mode by turning it off and then pressing and holding the volume down and power down buttons.
  • From your Linux PC, in the folder where boot.img is located, type:

     $ fastboot boot boot.img 
  • To create a partition type image of mmcblk0p23:

     $ adb shell 'stty raw && dd if=/dev/block/mmcblk0p23' > ~/userdata.img 

Useful links:

  • How do you define a section of interest: http://forum.xda-developers.com/showthread.php?t=2450045

  • If stty raw is not used, all LFs will be converted to CRLF: android.stackexchange.com/questions/69434/is-it-possible-to-cat-a-file-to-an-android-phone-and-dd-to -dev-xxx-on-the-fly-w

  • How to connect your phone and use unsafe boot.img: www.addictivetips.com/android/root-google-nexus-4-install-clockworkmod-recovery/

  • Passing binary data through the ADB shell (how to use stty raw): stackoverflow.com/questions/11689511/transferring-binary-data-over-adb-shell-ie-fast-file-transfer-using-tar

+2
source
  • Install TWRP .

    Select your device on the TWRP page and follow the installation instructions.
  • Upload to Recovery

    You may need to find a keyboard shortcut specific to your device in order to respond to the bootloader menu. If you checked TWRP with fastboot ( fastboot flash recovery twrp.img ), try fastboot reboot-bootloader , then select Recovery .
  • Partition Mounting in TWRP

    You should now be in TWRP. From there, select Mount. Make sure your data section is installed. Make sure your system partition is installed, as you will need some executable files that are there.
  • Connect adb

    Install adb if you haven’t done so already. Connect the phone to the computer using the USB cable. Enter adb devices . If you see a list of devices, then you are connected.
  • Forward adb forward tcp:33333 tcp:33333 port adb forward tcp:33333 tcp:33333

    We need to enable TCP access to your phone. This command listens on computer port 33333 (first argument) and redirects all connections to port 33333 on your phone. You can choose any port. Ports below 1024 on the PC require root access. Verify that the selected port is not yet in use. These two numbers must not match.
  • Find the partition you want to save adb shell mount

    Find the section you want to create and get the device name. [ EDIT : if the partition you need for backup looks like /dev/block/dm-0 , it is part of a logical volume (LVM), and this is probably the wrong way to back it up]
  • Forward raw section from phone

    • adb shell
    • Try dd if=/dev/block/dm-0 bs=64k | gzip | nc -l -p 33333 dd if=/dev/block/dm-0 bs=64k | gzip | nc -l -p 33333
      • This is /dev/block/dm-0 with the device you found from the mount command before.
      • Replace 33333 with the phone port you selected above
      • If any commands cannot be found, you can try adding them using /system/bin/toybox or /system/bin/busybox .
      • This command block copies from the specified device ( if= ) and, using the block size of 64k ( bs=64k ), you can specify either or omit this argument completely, but small values ​​will most likely slow down the process. Values ​​greater than 64k usually do not speed up the process), discards this to stdout , which is passed to gzip for compression, then passed to netcat, which listens ( -l ) on port 33333 ( -p 33333 ).
  • Dump data on your computer

    • From the new terminal, make nc localhost 33333 | pv -i 0.5 --size 54g > dm-0.raw.gz nc localhost 33333 | pv -i 0.5 --size 54g > dm-0.raw.gz
      • Replace 33333 with the computer port you selected above
      • Replace dm-0.raw.gz with any file name
      • Replace 54g size of your partition (see below)
      • This command connects to port 33333 on the local host (your computer) and resets to stdout , sends to pv , which updates the transmission every half second ( -i 0.5 ) with an estimated size of 54 gigs ( --size 54g - you can omit this argument, but it is necessary that the transmission progress is accurate), then to a file named dm-0.raw.gz
+2
source

how can I do the same on my Nexus 5 (LG-D821). Rooted Android 6.0.1. Recovery - CWM 6.0.4.5.

I write the command: $ fastboot boot boot.img (the phone is frozen and needs to be rebooted)

Conclusion:

root @ubuntu: / home / user / Desktop # $ fastboot boot boot.img loading 'boot.img' ...

OKAY [0.967s]

loading...

FAILED (reading status failed (no such device))

finished. total time: 45.929s

And after I write the command in the terminal: $ adb shell pull / dev / block / mmcblk0p28 userdatanexus.img.

Output / system / bin / sh: pull: not found

I want to create / userdata / image. Thanks

0
source
  • Install android-platform-tools or android-sdk on your computer.

  • Download TWRP .

  • Hold the volume down and volume up buttons and turn on the phone to launch the bootloader screen. Make sure your phone is connected to your computer’s USB port.

  • Download TWRP by running fastboot boot twrp-3.1.0.0.img . (There is no need to rewind your recovery partition in this way.)

  • In TWRP, select Advanced, then Terminal, which will open the shell. Type mount and press [ENTER] to view the partitions. You are looking for /data stands and possibly /sdcard .

  • Say your /data section appears in /dev/mmcblk0p28 . Just run adb pull /dev/block/mmcblk0p28 data.img on your computer and copy the section. Expect this process to take some time, as it copies the entire partition, regardless of how many files are stored in it.

0
source

Source: https://habr.com/ru/post/1207007/


All Articles