geffers
Posts: 375
Joined: Sun Jun 24, 2012 6:25 am
Location: UK
Contact: Website

dd won't copy

Fri Aug 23, 2019 9:48 pm

Folks,

I have Raspian desktop installed on a Pi3, all seems to be working fine. Connected to a TV and displays as expected, as no KB or mouse I do maintenance via ssh. I occasionally run apt-get update then upgrade which all completes successfully.

Today I wanted to back up the drive so extracted from Pi, installed into card adapter and inserted into laptop, both partitions appeared on file manager.

Then ran sudo dd if=/dev/<sdCard> of=<localfile.img> and it fails with unable to read block. Similar message if I run back or e2fsck. Tried badblock-v /dev/sdCard but have no idea when that is going to complete.

Replaced in Pi, boots up and appears to work fine.

Now, if operating system was giving problems I'd immediately think corrupted disk (which it may be anyway) but I thought dd just read byte for byte and copied bad bytes as well.

Any recommendations?

Geffers
Last edited by geffers on Tue Aug 27, 2019 11:15 am, edited 2 times in total.

User avatar
topguy
Posts: 5672
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: dd won't copy

Fri Aug 23, 2019 10:37 pm

Any recommendations?
Cut and paste here from the terminal when you try the commands, so we see exactly what you try and the exact error message.
Your chances for getting useful help is multiplied by 10.

fruitoftheloom
Posts: 20440
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: dd won't copy

Sat Aug 24, 2019 6:50 am

geffers wrote:
Fri Aug 23, 2019 9:48 pm
Folks,

I have Raspian desktop installed on a Pi3, all seems to be working fine. Connected to a TV and displays as expected, as no KB or mouse I do maintenance via ssh. I occasionally run apt-get update then upgrade which all completes successfully.

Today I wanted to back up the drive so extracted from Pi, installed into card adapter and inserted into laptop, both partitions appeared on file manager.

Then ran sudo dd if=/dev/<sdCard> of=<localfile.img> and it fails with unable to read block. Similar message if I run back or e2fsck. Tried badblock-v /dev/sdCard but have no idea when that is going to complete.

Replaced in Pi, boots up and appears to work fine.

Now, if operating system was giving problems I'd immediately think corrupted disk (which it may be anyway) but I though did just read byte for byte and copied bad bytes as well.

Any recommendations?

Geffers

Raspbian Buster with Desktop includes SD Card Copier, to clone the SD Card to another in a USB SD Card Reader, providing it has enough space !

If you are running in Cli only then try:

https://github.com/billw2/rpi-clone/blo ... /README.md
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

geffers
Posts: 375
Joined: Sun Jun 24, 2012 6:25 am
Location: UK
Contact: Website

Re: dd won't copy

Tue Aug 27, 2019 11:14 am

topguy wrote:
Fri Aug 23, 2019 10:37 pm
Any recommendations?
Cut and paste here from the terminal when you try the commands, so we see exactly what you try and the exact error message.
Your chances for getting useful help is multiplied by 10.
Not sure this is going to help but here it is;

Code: Select all

sudo dd if=/dev/mmcblk0 of=Backup-27Aug19.img bs=4096
[sudo] password for geoff: 
dd: error reading '/dev/mmcblk0': Input/output error
380+0 records in
380+0 records out
1556480 bytes (1.6 MB, 1.5 MiB) copied, 5.65675 s, 275 kB/s
Geoff

geffers
Posts: 375
Joined: Sun Jun 24, 2012 6:25 am
Location: UK
Contact: Website

Re: dd won't copy

Tue Aug 27, 2019 11:21 am

fruitoftheloom wrote:
Sat Aug 24, 2019 6:50 am

Raspbian Buster with Desktop includes SD Card Copier, to clone the SD Card to another in a USB SD Card Reader, providing it has enough space !

If you are running in Cli only then try:

https://github.com/billw2/rpi-clone/blo ... /README.md
Thanks for info - I know microSD cards are not the greatest for running OSs and have had various corruption in the past, normally just do a reinstall using old or new SD card but my query was more to do with dd on this occasion, I thought it would just copy the source disk including any bad bits.

It was more the fact the disk appears to work fine in the Pi, if it didn't then I'd just reinstall.

I'll have a look at that program though, thanks.

Geffers

User avatar
topguy
Posts: 5672
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: dd won't copy

Tue Aug 27, 2019 11:28 am

Not sure this is going to help but here it is;
Its hard to gauge a persons proficiency in CLI tools from just a forum post.

I would agree that faulty SD card is probably the best explanation. If its that early on the card it might not affect the main data partition.

Why "bs=4096" ? Was it an attempt to find out how early it fails ?
By experimenting with "skip" option you might figure out how large the error area is, but buying a new cards seems like the best solution.

User avatar
RaTTuS
Posts: 10407
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: dd won't copy

Tue Aug 27, 2019 11:31 am

Code: Select all

sudo dd if=/dev/mmcblk0 of=newback.img conv=sync,noerror bs=1M
how much space do you have on your machine

Code: Select all

df -h
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “General discussion”