TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: BIG UMBERTO
from: MARTIN GREGORIE
date: 2017-02-22 23:47:00
subject: Re: Black-out

On Wed, 22 Feb 2017 23:10:15 +0100, BIG Umberto wrote:

> The other day my neighborhood remained in the dark for a 2 hour for
> blackout. My raspberry when energy is returned has made several attempts
> to restart idle, then work again "apparently" on a regular mode.
> In earlier (many and many) times when it was switched off by
> disconnecting the power, however, it was always started with a normal
> boot.
>
Just because you've got away with pulling the plug in the past is no
guarantee that it will work the next time.
> Today another blackout caused a restart with a dozen empty attempts.
>
> What may have happened?
>
The blackout may very well have corrupted the SD card. If the card was
'wear levelling', which involves remapping its sectors and isn't an
instant operation, the blackout happened may have terminally corrupted
the SD card.

Get another card, download the latest Raspbian image and install it on
the new card. If your RPi boots off that, then card corruption was the
problem and you can get your stuff back by reloading /home/* from your
latest backup.

No backup?
- Plug in a USB SD card reader
- put the old card in it
- run fsck against its biggest (type 83) partition.
  There are two partitions on the disk. The 56MB one is just the
  boot partition. The other, bigger, type 83 one contains the
  Raspbian filing system.

If fsck reports no errors:
- get another new SD card
- use fdisk on the RPi or gparted (on a Linux or Windows system)
  to delete the FAT 32 partition on it and create a type 83
  Linux partition occupying the whole card.
- mount the old, damaged SD card in the RPi using a second USB
  SD card reader.
- use dd to copy the Linux partition from the old card onto the
  card you just reformatted.

You can now use an SD card reader to mount the card containing
the copied filing system on your RPi and copy any files and programs you
need from your old filing system into the newly installed Raspbian
system, but unless you know exactly what you're doing *DON'T* copy
anything that isn't in /home or /usr/local, i.e. no config files from
/etc or you're likely to mess up Raspbian or, worst case, misconfigure it
so badly it becomes impossible to boot.

You can also try reformatting the original SD card. If the problem is
just a damaged filing system you'll be able to recreate the partition(s),
reformat them and use the card for something else. If you can't do that,
its junk, so bin it.

Now get at least another two SD cards, use fdisk to put a single single
type 83 Linux partition on each of them, reformat that and use them for
backups. In future make backups more frequently.

I turn Raspbian automatic updating off so I can't be surprised by an
update 'just happening', and every week I make a backup immediately
before running a manual upgrade using apt-get.

Backing up before doing the upgrade makes sense but you may also want to
make more frequent backups. I use a version control system (cvs, though
git may be better) to capture changes to my various projects. The master
repository is on one of my Linux desktops which runs an overnight backup
every night, so no matter what happens short of a house fire, I can't
loose more than 12 hours of work.

For slightly more elaborate backup schemes, look here:

http://www.libelle-systems.com/free/rpi/getting_started.html
http://www.libelle-systems.com/free/linux/adding_software.html
http://www.libelle-systems.com/free/linux/easier_upgrades.html

The last two describe what I do on my Fedora systems but are equally
applicable to Raspbian: I've done the same for my RPi.

Good luck.
----------


--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.