# [solved] dd if=/dev/mmcblk0 fails after reading 10MB

## maiku

Up until two days ago, I was mysteriously able to write to and read from /dev/mmcblk0 with dd. Now, all of the sudden it gives me a "not enough space on device" error when I try to write and only reads 10MB when I try to read. *Quote:*   

> sudo dd if=/dev/mmcblk0 of=test.img 
> 
> 20480+0 records in
> 
> 20480+0 records out
> ...

 Or if I try to write an image *Quote:*   

> sudo dd if=test.img of=/dev/mmcblk0
> 
> dd: writing to ‘/dev/mmcblk0’: No space left on device
> 
> 20481+0 records in
> ...

 However! If I try to read from /dev/mmcblk0p1 or /dev/mmcblk0p2 it'll work just fine.

These are Raspberry Pi images, so I need to write them directly to /dev/mmcblk0.

What could have caused this strange one?

----------

## NeddySeagoon

maiku,

I suspect that you have a bad block at around 10Mb.  Unless you tell dd what to do about errors, it just stops.

dmesg will tell you.  Run the dd until it fails, then look in dwesg.

If you do have a bad block, the only way that dd can continue is to drop the data at that location.  Its an image file, it either works or it doesn't.

You can loop mount the image and use the filesystems it contains.

----------

## frostschutz

blockdev --getsize64 /dev/mccblk0?

----------

## maiku

Forgot to comment on this. Thanks Neddy for commenting again on one of my drive madness posts.

I can't honestly say why it stopped working. I thought it was the card, too, at first. So I changed the cards. After the fourth card I thought, "It's probably not the card." Then on a whim I upgraded the kernel and it started working flawlessly again. So I just kind of left it at that.

Thank you for all of your help! <3

----------

