Up to Main Index                         Up to Journal for September, 2018

                   JOURNAL FOR SUNDAY 16TH SEPTEMBER, 2018
______________________________________________________________________________

SUBJECT: A well earned break and reviving an SD card
   DATE: Sun 16 Sep 16:55:33 BST 2018

Last week I took a break from everything. Well, at least I tried. All I had
access to was my Nokia 5, Chromebook and Raspberry Pi Zero W. I was in the
middle of nowhere for a week. No mobile phone signal — unless the atmospherics
were just right, even then holding onto the very weak signal for more than 30
seconds at a time was nearly impossible. The internet connection I had was a
lot slower than usual and used by more people and devices. I did still manage
to keep an eye on the servers at work and attend to a few work related issues.

I was also working on WolfMUD :)

This explains why I had been spending so much time recently working on a
mobile development environment. The Chromebook and Zero W combo worked out
very well for doing some actual (day job) work and for working on WolfMUD.

Since being back the SD card in my very first Raspberry Pi (Model B, rev 2)
seems to have died. Symptoms are: Pi becomes non-responsive over the network,
no SSH or ping, green activity light permanently on, rebooting fails with
green activity light permanently on after a short period of time.

I thought I’d make some notes here, just in case it helps someone else out.

The SD card is an old, cheap, full size, SanDisk 4Gb class 4 card. Being only
a 4Gb card it was also 80% full most of the time, which is not good for an SD
card — currently it’s at 45% full. It has lasted nearly 6 years[1], running
24x7, with an EXT4 file system with journaling turned on. I’ve managed to get
the card working again by using a USB card reader[2] attached to my desktop.

I started off by making a backup the SD card to the desktop:


  dd conv=noerror status=progress bs=128M if=/dev/sdc of=./`date +%F-%T`.img


The option are: conv=noerror continue after errors, status=progress display
progress, bs=128M read and write 128Mb at a time, if=/dev/sdc the input device
(SD card), of=./`date +%F-%T`.img the backup image - local file with a
timestamped name.

Then I identified bad blocks and repaired the file system on the SD card:


  fsck -text4 -f -c -k -C /dev/sdc2


The options are: -f force checking, -c badblocks read only scan, -k preserve
current bad block list and add new ones found, -C display progress. This
command identified 12 bad blocks on the SD card.

I then put the SD card back into the Pi, booted, and ran debsums to help
sanity check and identify any corrupt files for packages I had installed on
the system:


  debsums —ca


The options are: -c report changed files, -a also check configuration files.

Any identified packages were then reinstalled. Although the Pi is running
happily again I wouldn’t trust the SD card with anything important. This
particular Pi is not used very much now — it’s slower than the Zero. What I
think I will do is keep the Pi running with the ‘fixed’ SD card and see what
happens out of morbid curiosity :) I wonder how long it will last?

--
Diddymus

  [1] The card was first used in the Pi on 28th October 2012 when I received
      the Raspberry Pi. I’m not 100% positive but it may have been an old,
      used SD card I had laying around. Lifetime writes reported by tune2fs
      for the card shows 150Gb, but I don't know how accurate that is.

  [2] Specifically a Kawau C296 USB SD & Micro SD Card Reader that cost £2.99
      and worth every penny!


  Up to Main Index                         Up to Journal for September, 2018