0

I am currently running Raspbian on Raspberry PI 3 and the SD memory card I've been using as hardrive on my pi is somehow got damaged probably from using it for a very long time.

Whenever I boot or turn my pi on, on the display it says among other things memory location is not readable OR Failed mounting SD Card. Then, it eventually times out waiting at the Console Prompt. No GUI is loaded. Well, after this, I would power recycle the PI again hoping that Raspbian Desktop will be loaded. Desktop may or may not load. I power recycle it again. Eventually, everything goes through and Raspbian Desktop is finally loaded. I've done a lot of work on this Raspbian PI in setting it up. If and when the SD card finally FAILS COMPLETELY, I will loose a lot and will have to start from scratch building it back again.

I have thought about Cloning and I do clone PI's SD card using Win32DiskImager on window. This program is fantastic. However, when I try to clone the damaged SD Card, it fails and reports that some of the memory location is not READABLE. Even though I have all the files from the damaged SD card saved and/or backed up, I will loose all the setup and settings for a lot of programs I downloaded and installed.

So, my question is this. Can you backup or save the current session? So, I can save the programs setups or settings for installed programs.

ThN
  • 1,063
  • 6
  • 22
  • 35

2 Answers2

2

It's unclear why you're just now looking for a solution, given the importance you attach to your files, and the impact of a loss. But I'll leave that for you to ponder. In the meantime, I would guess that each time you use the SD card to boot and run, your prospects of permanent loss increase. I'd stop that right away, and get on with the backup process.

Given the status of things as you've reported, I would attack on two "fronts":

  1. Most of your configuration work will be in one of two locations: /etc and /home/pi. Therefore, back those up as follows:
cd /
sudo tar czf pi_etc.tar.gz etc
cd /home
sudo tar czf pi_home.tar.gz pi

Move those two tarballs to an external drive asap.

  1. Follow DougieLawson's advice and make a "live" backup image. If you don't have an SD card reader to plug into your Rpi, use a thumb drive. Insert your drive, and mount it. Assuming a mount at /dev/sda:

dd if=/dev/mmcblk0 of=/dev/sda bs=1M.

Once you've got the image file, you may wish to try ddrescue as @eftshift0 suggested. I have no experience with it, and I can't comment further.

Good Luck & let us know how you get on - your feedback will help others.

EDIT/UPDATE (2021-05-24):

  1. It may be futile, but in the interest of "covering all the bases" you should verify that you are running fsck during the boot process. You should also review/check fsck results logged to var/log/syslog (by default). See this answer for further details.

  2. Depending on what you find on fsck in var/log/syslog you may wish to consider running fsck manually on your SD card. See man fsck and man e2fsck for the documentation, and options. This answer contains a step-by-step procedure for running fsck on your SD card.

  3. Your difficulties underscore the importance of maintaining valid backups. There are a variety of ways to do this - my preferred approach is a utility developed exclusively for the RPi: image-backup.
    This answer contains the "how-to" details.

  4. Finally, consider using only high quality SD cards from a reputable manufacturer - avoid the generics like the plague. There are lots of people who get paid to prognosticate on SD cards. IMHO, these prognosticators are mostly ill-informed hacks and/or shills, but if you do some research, you'll be able to develop a consensus of opinion.

Seamus
  • 21,900
  • 3
  • 33
  • 70
1

Perhaps ddrescue could be what you are looking for to recover the bits and pieces that you care about from the memory card.

https://www.gnu.org/software/ddrescue/

eftshift0
  • 750
  • 1
  • 7
  • 12