Recover a backup

I have a backup of dietpi made from dietpi-backup, and I copy all the backup on a server via FTP. The raspberry and the server isn’t in the same place.
Do you know if there is a way to restore it from a windows pc or Linux without having to take the Raspberry, do a clean installation of dietpi and then proceed with the recovery?
I would like to restore the backup on a microsd without the raspberry and replace the damaged one.

I would assume that this will not work, because the DietPi system images execute a firstboot procedure which prepares the system at the very first startup.
At least this procedure need to be done. The resulting image might be used to mount it on a different system and copy the backup to the SD card. (I am not aware how to preserve all file properties, like owner, rights, etc. when copying the files).

What about doing this job via the file dietpi.txt?
See DietPi/dietpi.txt at master · MichaIng/DietPi · GitHub and search for the entry AUTO_SETUP_BACKUP_RESTORE:

# Restore a DietPi-Backup on first boot: 0 => disable | 1 => interactive restore (show list of found backups) | 2 => non-interactive restore (restore first found backup)
# - Simply attach the drive/disk/stick with contains the backup. All attached drives will be mounted temporarily and searched automatically.

Then you need of course set up several more entries in the file like network, etc.

BTW: If you investigate on this kind of backup procedure it would be nice if we could improve our documentation. I.e. a step by step instruction with screenshots would be appreciated so that we could integrate this into our DietPi docu Usage hints/HowTo area.

Ok. I try in the next day and if I find a way to resolve my problem I make a step by step instruction.
Thank you.

1 Like

Another problem you could encouter, if you try to restore it from a windows PC (if the backup is saved on NTFS/FAT filesystem) is, that permissions and systemlinks are not preserved. This will break your backup and your system is going to encounter errors after the restoration.
I think the dietpi-backup script takes care of this problem, but when you copy the backup later with FTP to a non-posix filesystem, there is no script which will warn you about this.

Alternatively you could create an image or mirror your whole system with dd, to have “ready-to-use” backup of your system.

An advantage of using the dietpi-backup is the automated backup feature of your (running) system. This is very comfortable.

The backup could be copied as a tar (tar.xz) archive via FTP (then also a password protection is possible).
E.g. like tar cfvz systembackup.tar.gz /mnt/dietpi_backup/ or similar.
Then using the gpg -c systembackup.tar.gz to protect it to a .gpg file.
This file is then be FTP’d to your remote storage.

The unzip then needs to be done on a Linux system, e.g. unpacking it to a USB stick which will be the source for the firstboot restore option.
First unprotect via gpg -d systembackup.tar.gz.gpg > systembackup.tar.gz
Then unzip/untar via tar xfvz systembackup.tar.gz

Disclaimer :slight_smile: : I did not test this, so the steps above have to be checked.

1 Like

if we are taking about very same SBC, running same version of DietPi, a restore should be possible. But this would require a running system on target side. If the system on target side is already death, it would need to be flashed again first. Best is to have the backup stored on another USB stick. To copy a backup, a Linux system would need to be used, as on Windows you will lose file system permissions.