0

So at some point I think a power failure 'did for' my old SD card in my Pi. I've tried overwriting the boot partition with a newer one but it just isn't booting. I get the rainbow screen. HOWEVER, if I pop the SD Card into a USB reader, I can see that all the files from the linux partition are still there, and all the ones I've tried to read to check for corruption open fine. They seem in good health.

So what I've done is got a SECOND SD card, imaged it with the Pi OS I use, and then put both SD cards into two readers and connected both to a Linux box I have.

So now I have both systems' linux partitions mounted.

I want to overwrite the newly imaged partition with my older partition with all my settings, programs and info.

I've tried 'dd' - took hours and hours and I don't think it ever fully finished before I gave up, thinking there must be a better way.

I then tried rsync but something about the .npm cache folders kept causing rsync to fail, citing incompatibilities.

So now I'm thinking of trying just plain old cp, but is this likely to fail too, for some currently unforseen reason?!

I guess I avoided cp initially because I thought rsync might be cleverer and not bother overwriting identical files.

thanks!

The rsync error:

rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/3e/49/de94dc18e014dbb0e3cf665afbdbe101c07d9d90b443db408f133f6a649c5ce8199b7b3bf703a6ae1747043ac590c392c3bb292adb325f19b7b57e7c7494
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/3e/58/5d15c8a594e20d7de57b362ea81754c011acb2641a19f1b72c8531ea39825896bab344ae616a0a5a824cb9a381df0b3cddd534645cf305aba70a93dac698
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/3f/8b/bc84b7b11607b5ba468e00b9df47dceb7cc1561fe645a9569753d74e7fa3582a3458bc1c78cac5c3fd9e5a6a533d41bbab1dcffff07a7eeebf3730a370b9
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/40/a0/d3ff3b3ccc77cf5693d157ea67c9131c74e29bf1cfaa7b6ce26607dcd49a4aea97e9d19e965be2c8ef7184ba8521c3b277c72ce35b108f486c242ec1c39f
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/43/79/08c401ab13401cf27d1df997dd274bf8c4c095cb31bfb59002f936fff68cb0b8f0c4d443564ccda5eaf439500917aad44773080a20fa65408b7df7932efa
home/asterisk/.npm/_cacache/content-v2/sha512/43/dd/01b643130f9511cdbfd30564242f54f20ee0aceae73429ed4fb0c9fa1087322b0fa037fd6e2268964cc24a5283d5e13240ba7ab94118eb8225ba845bf98c
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/44/37/9a5c76270a367e15fd658d38d308db8a1a843db53f360744744d77ffb78cfb7df8ac43daa7499ae31f1c876e37bf354801ff051ee502d8fddae8ae7eb86a
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/45/11/023ec8fb8aeff16f9a0a61cb051d2a6914d9ec8ffe763954d129be333f9a275f0545df3566993a0d70e7c60be0910e97cafd4e7ce1f320dfc64709a12529
rsync: readlink_stat("/mnt/usbdrive2/home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3/n") failed: Input/output error (5)
home/asterisk/.npm/_cacache/content-v2/sha512/47/f7/b6d3757db5a60e15c8660b00c94e074aecce68c84a79eae727f6353fe4d765de5943f8dd3b14613433ab82ceb5e7dec56888fdc5be1a713139730bca85af
ABORTING due to invalid path from sender: home/asterisk/.npm/_cacache/content-v2/sha512/d9/f3
rsync error: protocol incompatibility (code 2) at flist.c(2484) [receiver=3.1.2]
daneee
  • 61
  • 4

2 Answers2

1

dd may take quite a while, especially if there's a problem with an sd-card. For these long actions, I generally add status=progress to the dd command line.

cp ans dd do very different things. With dd you copy all the "sectors" of the partition, even those that are empty. With cp, you only copy the files.

Unless your original and new image are version-wise the same, just copying the files may not be a good idea. You could run into some library mismatches, configuration differences et cetera.

When you do a cp, you should cp -a to preserve ownership, permissions etc.

Both dd and cp will stop if there is a read error.

In my Pi recovery efforts, most of the times cp has been the best tool.

The error message that rsync gives is about the part that is broken on your original SD card. You will not be able to copy that part. Not with rsync and not with cp.

Ljm Dullaart
  • 2,301
  • 7
  • 13
0

Frankly, it is unclear what you are actually trying to achieve.
The best approach is to create an installable image as backup BEFORE failure.
Backup image of SD Card

Trying to rsync from a failed image to a new card is a bad idea.

I suggest you only copy files from your home directory. This can be done on the Pi itself (with a SD Card reader on the Pi).

Milliways
  • 54,718
  • 26
  • 92
  • 182