Monday, September 02, 2024

raspberry pi not booting, error writing to SD card when reflashing with dd

One of the Raspberry Pis we use for video play-out in the waiting area was not booting. Simplest test was to use the other Pi's SD card and try booting with that one - worked. So, wanted to image that mini SD card to the one which was not booting. 

https://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/
sudo dd if=/dev/sdc conv=sync,noerror bs=64K | gzip -c > my-root.image.gz
took around 45 minutes -
32 GB SD card with 5.5 GB used with df -h, due to gz it became 7.7 GB

Could monitor through watch -
https://www.baeldung.com/linux/dd-monitor-progress

watch -d ls -alh my-root.image.gz

But when trying to write back to the sdcard which was not booting (file system tests showed no errors after 'repairing'), 

sudo su -
# gunzip -c my-root-boot.image.gz | dd of=/dev/sdc status=progress

But after 10 minutes or so,

dd: writing to '/dev/sdc': Input/output error

https://superuser.com/questions/35349/dd-clone-hard-drive-input-output-error-though-chkdsk-says-ok

Tried conv=noerror -

gunzip -c my-root-boot.image.gz | dd of=/dev/sdc conv=noerror status=progress

Still the same error.

Then tried writing the disk image to another (64 GB) mini-sdcard which happened to be here. That worked without errors, and the R Pi booted up fine. So, maybe there are some physical errors, we might need to reformat (full format) and copy the files back (instead of cloning.)

No comments:

Post a Comment