8

I have created an image of my Android device (Lenovo A6000) using the command

adb shell -c su 'dd if=/dev/block/mmcblk0p23 > data.img' 

Now I would like to flash this image to the same device, and I am trying to accomplish this using fastboot in the following way

sudo fastboot flash data data.img

I am using the latest version of fastboot shipped with Android's SDK.

Doing the above command I get the error

target reported max download size of 268435456 bytes
Invalid sparse file format at header magi
error: write_sparse_skip_chunk: 
don't care size 4894735982 is not a multiple of the block size 4096
fastboot: ../libsparse/sparse.c:143: 
           write_all_blocks: Assertion `pad >= 0' failed.

I suspect it has something to do with the sizes, the image appears to have size ~5GB while the reported max download size appears to be ~2GB.

But I am not sure what the real error is and how to fix it?

Can someone tell me where the mistake is and how to solve it? It seems that if I make a smaller image I can flash it properly.

5
  • Just asking: Why are you trying the hard way if the device is rooted? Isn't Nandroid backup good for the needs?
    – Firelord
    Commented Jul 23, 2015 at 16:45
  • 1
    Invalid sparse file format -- you didn't create a sparse file. Commented Jul 23, 2015 at 19:49
  • 1
    Apart from that: if you created the image with dd, what keeps you from restoring it the same way (from within recovery mode, of course)?
    – Izzy
    Commented Jul 27, 2015 at 0:37
  • Also you should try the -S option, to split the file while sending. fastboot loads the file over USB into RAM, not directly to the memory (NAND/SD/eMMC) etc... Commented Feb 2, 2016 at 19:28
  • try using this sparse converter. forum.xda-developers.com/showthread.php?t=2749797 Commented Dec 12, 2016 at 14:07

2 Answers 2

2

Android fsutils (on Ubuntu) comes with tools you need. You can also find them on GitHub. You need: simg2img, simg2simg, img2simg, make_ext4fs, and some terminal knowledge.

sudo simg2simg ./data.img ./data.raw.img

This gives you an image that can be mounted on Linux. To mount it, create an empty folder, then issue command...

sudo mount -t ext4 -o loop ./data.raw.img [new_folder_name]/

You can the find all the files in the folder you created. When you're done with the changes you want to make. Use this to make an Android image for fastboot.

sudo make_ext4fs -s -l [size_of_partition_in_bytes] -a data ./data data_new.img

The output will be the file data_new.img. Then you just use fastboot to flash like you normally would.

0

You can try this command from adb shell:

cat /proc/partitions

But mount lets you see /dev/block/bootdevice/by-name/ (in my case).

So if you do:

ls -al /dev/block/bootdevice/by-name/

You have all blocks you want to add.

But I'm still searching for how to add straight to a computer instead of an SD card.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .