Page 1 of 1

A wiki/guide on restoring a dead Pi

Posted: Tue Aug 27, 2019 7:39 am
by ghettopi
This isn't a complaint or anything, but because dietpi isn't completely stable. I'd really appreciate an official guide on how to restore a distro if you lose SSH access to it and therefore only have access to the SD card.

Either something that tells how to restore a backup or how to overwrite the SD image without destroying all of your hard work and custom settings. This is the third time that the device has died after an 'apt upgrade'. I'm now too afraid to run any update because it might mean hours of having to set up the device again. UNRAID gives you the option to just save a single directory on the SD card and re-flash the OS. I don't see this kind of feature for dietpi though sadly...

Re: A wiki/guide on restoring a dead Pi

Posted: Wed Aug 28, 2019 6:23 am
by johnvick
Plug in a USB flash drive and use

# dietpi-backup

If the system dies reflash and then restore the backup. No easier way as far as I know.

John

Re: A wiki/guide on restoring a dead Pi

Posted: Thu Aug 29, 2019 12:06 am
by ghettopi
What if you made the backup to the SDCard?

Is it possible to take the backup file off the SDCard before re-flashing it?

What file(s)/folder(s) exactly am I looking for?

Re: A wiki/guide on restoring a dead Pi

Posted: Thu Aug 29, 2019 4:35 am
by johnvick
A backup should always be put on different media from the operating system. The dietpi-backup utility is reliable and quick - best to do whole system backup but not hard to exclude e.g. media folders. I can't think of an easier and quicker solution and easy to restore if problems arise.

Re: A wiki/guide on restoring a dead Pi

Posted: Thu Aug 29, 2019 10:50 am
by ghettopi
Yes I understand but that doesn't answer my question.

I need to know what file(s) are made in the backup so I can take them from the SD Card this time and restore the settings. I'll use a USB next time, but for this time I need to know.

I have these files. Which ones do I need to save?

Image

Image

Re: A wiki/guide on restoring a dead Pi

Posted: Fri Aug 30, 2019 8:34 am
by johnvick
There is a lot missing here I don't know if you can recover from this @MichaIng may be able to advise.

John

Re: A wiki/guide on restoring a dead Pi

Posted: Fri Sep 27, 2019 12:07 pm
by MichaIng
@ghettopi
Sorry for late reply.

So basically if the system refused to boot, I would recover a full SDcard backup, which is included in dietpi-backup, since we don't know which files exactly are the issue.

So attach the drive with the backup to some PC as well as the SDcard with the broken system. It needs to be a UNIX system or VM so you are able to mount the ext4 root partition. Then remove content from each partition and copy (cp -a or rsync with flags) all files with permissions/symlinks preserved from backup back to the SDcard. Take care that /DietPi dir on ext4 partition is empty (this is tmpfs ramdisk) and /boot content from backup needs to be copied to the fat partition only (the one where you got the screens from).

But if this happens regularly then probably your SDcard is starting to die, causing file corruption. From an external Linux system (or VM) you can run some fsck to check and repair both partitions/file systems, which probably already solves the boot issue then. On the running system check dmesg for I/O errors after doing APT upgrades as well as check the APT output itself for errors.