[SOLVED] Restore Amanda backup

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: Openhabian 1.5
    • openHAB version: 2.3

Hi guys,
I need your help. I’m not much familiar with linux, but one year ago, I was able to setup my raspberry with openhab and create my smart home. I also set up backups in Amanda. Few days ago, my USB drive stop working and whole my settings are gone.
I still have Amanda backups on my external HDD drive. But sadly, I have no clue how to restore it.There are 15 slots from last days.
I made clean install into my raspberry on new usb drive. I went through Amanda documentation, but I’m completely lost :frowning:

Can somebody please help me to restore my data?

Difficult because we can’t teach you all the Linux basics on the go.
You need a Linux machine with a working Amanda install and your backup database to know what’s stored where… If you don’t have any, easiest is to install openHABian on another SD card.

If you have made dumps of one or more partitions, you can restore them as described here.
If your database was lost, see if there’s a copy on your backup HDD (openHABian creates those copies. Try recovering it from there, use tar to extract and cp to copy the files to your working system.
If you don’t manage to recover your database, you need to try this.

I know that you cannot learn me linux, and I’m really appreciate for your reply and help.

Now, I have new Raspberry with latest openhabian and also Amanda should be already instaled (not set up)
I also have mounted my external drive where is backup from Amanda.
But now, I’m not sure what I have to do, to restore that backup, or at least open it and copy my data.

What I have on external drive is:
Directory amanda-backup
amanda3
Directory with slots
amanda2
and data in slots
amanda1

Thanks

2 possibilities to try in this order:
Note I won’t take liability the commands are correct…

A

Restore your Amanda DB from your HDD to your local machine.
Setup Amanda first. Then sudo bash (to become root), as root

cd /
tar xpzf <amanda-backup dir>/amanda_data_20190211221504.tar.gz
cp -rp  <backup slots dir>/slot* <storage dir>/
chown -R root:backup <storage dir>/slots

Then try restoring your partition or files as explained in the Amanda README Restore section

B

if A) does not work see last section of Amanda README and play along the example to extract your files from the data in your slots dirs. Note they’ll either be a dump format or tar, depending on what you backed up.
Good luck

Ok, Thanks.
Now, I know how to restore files. Issue is, that it cannot see my backup.
When I set date to backup date, it always show me “500 No dumps on or before date…”
So it looks like database wasn’t restored.
I moved it into amand-backups directory and run “tar xpzf /amanda-backups/amanda_data_20190211221504.tar.gz”
It went without any errors.

Any idea?

Thanks

Come on I already wrote it:
cd / before tar xpf
and if it doesn’t work go for B)

And option B doesn’t work wor me. All files except 00005.myhome._dev_mmcblk0.0 are basicaly empty. They have 32KB. Only this one have around 12GB. But I don’t know how to open it. I tried last page from tutorial, but without success. It’s not tar file.

Well then unfortunately there was nothing backed up on those dates (which also explains the “no dump” output). Use amoverview <config> to get a hint what’s there.
You could try setdisk /dev/mmcblk0 in amrecover for that only file to contain anything.

Not 100% sure but it should be a gzip’ed raw copy of the partition. You can use dd to write it to an external SD writer (/dev/sda or whatever that shows up as). You can mount it like an ISO, too, see https://major.io/p/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/

[00:36:37] root@openhabianpi:/volatile/backup/slots# dd if=slot9/00005.openhabianpi._dev_mmcblk0.0 bs=32k skip=1 of=/volatile/temp/restoretest
[00:44:07] root@openhabianpi:/volatile/backup/slots# file /volatile/temp/restoretest
/volatile/temp/restoretest: gzip compressed data, last modified: Thu Sep 26 23:13:37 2019, max speed, from Unix, original size 3046637568
[00:44:26] root@openhabianpi:/volatile/backup/slots# gunzip -c /volatile/temp/restoretest>/volatile/temp/restoretest2
[00:44:26] root@openhabianpi:/volatile/backup/slots# #untested: dd if=/volatile/temp/restoretest2 of=/dev/sda bs=1M
1 Like

Thanks a lot, man!
I was able to mount that file as image.
I have to solve backups better for future.

Glad I was able to help
Well you essentially did the right thing in installing Amanda. It’s just you didn’t validate your backups as recommended in the README. Start with checking /etc/cron.d/amanda, it should start them once a day and run amreport <config> daily to see what’s going on.

I had backups from each day. There are slots and modification dates fits. Weird is, that data in all slots are same. It’s few months old backup. It looks like same date as last manual backup of openhab. But anyway, it helped me a lot. I have to go again through readme and wind what I screwed.

If you still have your backups, could you please try if using this makes them accessible from Amanda again ?

[11:29:09] backup@openhabianpi:~$ amreindex
USAGE:  amreindex [ --timestamp|-t timestamp ] [-o configoption]* <conf>
USAGE:  amreindex [-o configoption]* [--exact-match] <conf> [hostname [diskname [datestamp [hostname [diskname [datestamp ... ]]]]]]
    amreindex re-index Amanda dump images by reading them from storage volume(s)
    Arguments:
        config       - The Amanda configuration name to use.
        -t timestamp - The run of amdump or amflush to check. By default, check
                        the most recent dump; if this parameter is specified,
                        check the most recent dump matching the given
                        date or timestamp.
        --exact_match   - host, disk and datestamp must match exactly.
        -o configoption - see the CONFIGURATION OVERRIDE section of amanda(8)
[11:29:47] backup@openhabianpi:~$