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.

  • Just asking: Why are you trying the hard way if the device is rooted? Isn't Nandroid backup good for the needs?
    – Firelord
    Jul 23 '15 at 16:45
  • 1
    Invalid sparse file format -- you didn't create a sparse file. Jul 23 '15 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
    Jul 27 '15 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... Feb 2 '16 at 19:28
  • I have the same exact issue did you find any fix?
    – user178690
    Jul 27 '16 at 9:55

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.


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 how to add straight to computer instead to sd card.. if somebody knows how. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.