There is damaged SD card, some problems with connectors I guess. After plugging in this SD Card mounts and becomes readable for about 30 seconds and data is reachable for download then for some time the card is gone, then connects again and falls ... and so on.
My question is: how can I read data from the SD card? I see it like this: one should write some script in bash, where data would be downloaded in infinite loop, using
dd
or
cp
but for me is unclear, what to do if SD umounts and "goes away".. how can I "remember" the stop point to contiue again when SD card returns? If use command
sleep()
then what should stand for argument? When the card connects again is unclaer, it can be 20 seconds, 30, 44 seconds.. and how to continue the process from the point of stop? There is a way to delete copied data, but it is troublesome.
What do you think which way is the best one and how script should be organized?
Thank you in advance!