no I mean before the $ in backups/amanda_data_$(date +%Y%m%d%H%M%S)
So Iāve changed the backup.sh like this :
mkdir -p ${storage}/amanda-backups; chown ${backupuser}:backup ${storage}/amanda-backups
echo "0 2 * * * root (cd /; /bin/tar czf ${storage}/amanda-backups/amanda_data_\$(date +%Y%m%d%H%M%S).tar.g$
and reinatalled Amanda again.The Cron entry now looks like this:
0 1 * * * backup /usr/sbin/amdump openhab-dir >/dev/null 2>&1 0 18 * * * backup /usr/sbin/amcheck -m openhab-dir >/dev/null 2>&1 0 2 * * * root (cd /; /bin/tar czf /storage/server/amanda-backups/amanda_data_$(date +\%Y\%m\%d\%H\%M\%S).tar.gz etc/amanda var/lib/amanda var/log/amanda; find /storage/server -name amanda_data_\* -mtime +30 -delete) >/dev/null 2>&1
ok, that now should work for you
(reposting because i previously replied to the wrong person)
Hi! Hoping for some help. I have read the Amanda readme and I managed to NFS-map my NAS, and to install Amanda. So far so good, but Iām stuck on the whole SD-card backup thing.
Iām not using an SD card, Iām using an SSD. Itās 64 gigabytes, but obviously nowhere near full.
Backing up the openHAB conf and userdata folders is certainly useful, and perfect for Amanda to do every night, but I would also like to periodically back up the entire system. But (although i havenāt tried this yet), it seems like Amanda would do it in a raw manner, where the backup would take 64 gigabytes and have lots of zeroes. Thatās not what I want ā I would like it to back up only those sectors that are used, and I would like it to compress.
Essentially, I guess Iām looking for an unattended version of Clonezilla that doesnāt require me to shut the system down and unplug the drive!
For example, the clonezilla backup of my 64 GB SD-card which has 5.8GB used actually uses 3.0 GB of storage space. Thatās a manageable size. I could see doing that once a week on a schedule, and having four backup slots used in a round-robin manner.
Is it possible to make Amanda do that? If not, do you have any recommendation?
Clonezilla is the live linux USB environment, it uses a tool called āpartcloneā to do the work, if that helps.
Well NO system can backup a raw device and just use as much space as is used on filesystem level because it does not know the space is unused.
You can make Amanda compress dumps.
Try appending this to amanda.conf and use this new dumptype ācomp-amrawā in disklist
define dumptype comp-amraw {
global
program "APPLICATION"
application "app_amraw"
compress fast
}
Hello everyone,
I am failing to get the Amanda backup to run.
[16:55:34] openhabian@openHABianPi:/storage/server$ ls -l
total 12
drwxrwxr-x 2 root root 4096 Jan 3 16:08 amanda-backups
drwxrwxrwx 2 root root 4096 Jan 3 14:33 openHABianPi
drwxrwxr-x 17 root root 4096 Jan 3 16:15 slots
[16:55:38] openhabian@openHABianPi:/storage/server$ cd slots/
[16:55:43] openhabian@openHABianPi:/storage/server/slots$ ls -l
total 60
lrwxrwxrwx 1 root root 21 Jan 3 16:05 drive0 -> /storage/server/slots
lrwxrwxrwx 1 root root 21 Jan 3 16:05 drive1 -> /storage/server/slots
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot1
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot10
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot11
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot12
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot13
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot14
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot15
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot2
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot3
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot4
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot5
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot6
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot7
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot8
drwxrwxr-x 2 root root 4096 Jan 3 16:08 slot9
lrwxrwxrwx 1 root root 21 Jan 3 16:15 slots -> /storage/server/slots
[16:55:45] openhabian@openHABianPi:/storage/server/slots$ sudo su - backup
[16:56:29] backup@openHABianPi:~$ amcheck openhab-dir
Amanda Tape Server Host Check
-----------------------------
slot ?: Can't make directory '/storage/server/slots/drive2': Permission denied
ERROR: Can't make directory '/storage/server/slots/drive2': Permission denied
NOTE: host info dir /var/lib/amanda/openhab-dir/curinfo/openHABianPi does not exist
NOTE: it will be created on the next run.
NOTE: index dir /var/lib/amanda/openhab-dir/index/openHABianPi does not exist
NOTE: it will be created on the next run.
Server check took 0.775 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 2.801 seconds. 0 problems found.
(brought to you by Amanda 3.3.9)
[16:56:38] backup@openHABianPi:~$ amreport openhab-dir
nothing to report on!
[16:57:53] backup@openHABianPi:~$ amdump oenhab-dir
parse error: could not open conf file "/etc/amanda/oenhab-dir/amanda.conf": No such file or directory
amdump: errors processing config file at /usr/sbin/amdump line 79.
[16:58:02] backup@openHABianPi:~$
I get the issue message that sth. with permissions is not correct. I am not that familiar with linux. I followed the Amanda guide proposed by @mstormi step by step.
my fstab locks like this:
192.168.XX.XX ://volume1/RaspBackup /storage/server nfs nolock,noatime 0 0
My backup user is uid=34, but where to enter this?
My disklist:
openHABianPi /etc/openhab2 user-tar
openHABianPi /var/lib/openhab2 user-tar
I understood, that a 32gb disc is to large to backup completely, so I will do this manual by a tool like PiBaker etcā¦
At no point in the docs is sth. written that permissons for the backup user have to be added. Hope you have a hint for me regarding this permission issue that I can start with backing up the system.
thank you
Woogi
Thatās not correct. You donāt actively have to because the install script does it for you, but you missed this section:
https://github.com/openhab/openhabian/blob/master/docs/openhabian-amanda.md#software-installation
The install routine will set the slots and other subdirs to be owned by the backup user.
That it is not on your system so you made a mistake on setting that up.
Again, check the aforementioned section (on no_root_squash
), I suspect thatās your problem.
Hi @mstormi,
thank you for the quick reply.
This is right, my understanding of āAmanda install routine should do that for you, but it only CAN do it for you if you created/mounted it before you ran the installation.ā I did the mount of the folder before starting the installation, and followed the steps in the example. Did I missed sth.?
I did the installation again, but still the same result at the end of the process:
openhabian:x:1000:1000:,,,:/home/openhabian:/bin/bash
/bin/chown: changing ownership of '/storage/server': Invalid argument
/bin/chown: changing ownership of '/storage/server/slots': Invalid argument
chown: changing ownership of '/storage/server/slots/slot1': Invalid argument
chown: changing ownership of '/storage/server/slots/slot2': Invalid argument
chown: changing ownership of '/storage/server/slots/slot3': Invalid argument
chown: changing ownership of '/storage/server/slots/slot4': Invalid argument
chown: changing ownership of '/storage/server/slots/slot5': Invalid argument
chown: changing ownership of '/storage/server/slots/slot6': Invalid argument
chown: changing ownership of '/storage/server/slots/slot7': Invalid argument
chown: changing ownership of '/storage/server/slots/slot8': Invalid argument
chown: changing ownership of '/storage/server/slots/slot9': Invalid argument
chown: changing ownership of '/storage/server/slots/slot10': Invalid argument
chown: changing ownership of '/storage/server/slots/slot11': Invalid argument
chown: changing ownership of '/storage/server/slots/slot12': Invalid argument
chown: changing ownership of '/storage/server/slots/slot13': Invalid argument
chown: changing ownership of '/storage/server/slots/slot14': Invalid argument
chown: changing ownership of '/storage/server/slots/slot15': Invalid argument
chown: changing ownership of '/storage/server/amanda-backups': Invalid argument
my Serverconfig locks like this:
This is what I could select as well:
Did I do sth. else wrong? Do you have an other hint?
Thank you so far.
Sorry for being harsh, but youāre not great at reading, are you ?
Sorry, am not an IT-guy,ā¦everything takes a bit longer, doing/learning ist from scratch.
I postet my fstab line, here again:
How can I add there the squash thing? Did not found a hint in the docu. Sorry again, this is not easy to meā¦
@mstormi You mentioned, it is a NFS client thing, and not a server (NAS) side thing. So I searched again. I found sth. with an /etc/exports file.
Do I have to create such a file and add there my path like this:
/storage/server IP.ADRESS (rw,no_root_squash)
I found this here. Based on this, nothing else is needed. Before I scratch sth, does someone else having such a file?
Thank you very much for your help.
Yes. Unlike what I wrote (sorry, it was from memory) this needs to be done on the NFS server.
But as your server is a NAS, it may or may not like you to manually edit the exports file there.
Better to use the GUI. But I donāt know your NAS so you will have to find out yourself how that works.
Try Root zu admin zuordnen
.
@mstormi thank you for the hint.
The user changed from root, to nobody and users - is that a progress?
lrwxrwxrwx 1 nobody users 21 Jan 3 20:11 drive0 -> /storage/server/slots
lrwxrwxrwx 1 nobody users 21 Jan 3 20:11 drive1 -> /storage/server/slots
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot1
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot10
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot11
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot12
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot13
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot14
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot15
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot2
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot3
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot4
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot5
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot6
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot7
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot8
drwxr-xr-x 2 nobody users 4096 Jan 3 20:11 slot9
issue message:
$ apt-get -y install amanda-common amanda-server amanda-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
amanda-client is already the newest version (1:3.3.9-5).
amanda-common is already the newest version (1:3.3.9-5).
amanda-server is already the newest version (1:3.3.9-5).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
openhabian:x:1000:1000:,,,:/home/openhabian:/bin/bash
/bin/chown: changing ownership of '/storage/server': Invalid argument
/bin/chmod: changing permissions of '/storage/server': Operation not permitted
/bin/chown: changing ownership of '/storage/server/slots': Invalid argument
chown: changing ownership of '/storage/server/slots/slot1': Invalid argument
chown: changing ownership of '/storage/server/slots/slot2': Invalid argument
chown: changing ownership of '/storage/server/slots/slot3': Invalid argument
chown: changing ownership of '/storage/server/slots/slot4': Invalid argument
chown: changing ownership of '/storage/server/slots/slot5': Invalid argument
chown: changing ownership of '/storage/server/slots/slot6': Invalid argument
chown: changing ownership of '/storage/server/slots/slot7': Invalid argument
chown: changing ownership of '/storage/server/slots/slot8': Invalid argument
chown: changing ownership of '/storage/server/slots/slot9': Invalid argument
chown: changing ownership of '/storage/server/slots/slot10': Invalid argument
chown: changing ownership of '/storage/server/slots/slot11': Invalid argument
chown: changing ownership of '/storage/server/slots/slot12': Invalid argument
chown: changing ownership of '/storage/server/slots/slot13': Invalid argument
chown: changing ownership of '/storage/server/slots/slot14': Invalid argument
chown: changing ownership of '/storage/server/slots/slot15': Invalid argument
chown: changing ownership of '/storage/server/amanda-backups': Invalid argument
2020-01-03_20:11:26_CET [openHABian] Checking for default openHABian username:password combination... FAILED
2020-01-03_20:11:27_CET [openHABian] We hope you got what you came for! See you again soon ;)
[20:11:27] openhabian@openHABianPi:/etc$ sudo su - backup
[20:11:38] backup@openHABianPi:~$ amcheck openhab-dir
Amanda Tape Server Host Check
-----------------------------
slot ?: Can't make directory '/storage/server/slots/drive2': Permission denied
ERROR: Can't make directory '/storage/server/slots/drive2': Permission denied
NOTE: host info dir /var/lib/amanda/openhab-dir/curinfo/openHABianPi does not exist
NOTE: it will be created on the next run.
NOTE: index dir /var/lib/amanda/openhab-dir/index/openHABianPi does not exist
NOTE: it will be created on the next run.
Server check took 0.735 seconds
@mstormi I found the following which could help:
How can I give these permissions? and how can I add the user to a group?
If you could help me here this would make the day
The problem is your NAS server to map User IDs.
Frankly it should have worked with the initial setting (no mapping) so you better google how that is supposed to work on your NAS.
Iāve checked my NAS exports file and it has the no_root_squash option set.
If you are not afraid you can try to manually edit and use the exportfs command. But I take no responsibility for thatā¦
[~] # cat /etc/exports
"/share/CACHEDEV1_DATA/Public" *(rw,async,no_subtree_check,insecure,no_root_squash,fsid=187f07688af237f648d8f7126f908066)
"/share/NFSv=4" *(no_subtree_check,no_root_squash,insecure,fsid=0)
"/share/NFSv=4/Public" *(rw,nohide,async,no_subtree_check,insecure,no_root_squash,fsid=187f07688af237f648d8f7126f908066)
[~] # exportfs -a
[~] # exportfs
/share/CACHEDEV1_DATA/Public
<world>
/share/NFSv=4 <world>
/share/NFSv=4/Public
<world>
I have an openhabian based system running with the /boot on a 16GB SD card and the / filesystem on a 120GB 2.5" SSD. This configuration was based on advice to use an SSD for the / as it would cope better with regular disk writes than an SD.
I have attached fdisk, mount, and df outputs for my system below.
# fdisk -l
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc6129374
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532480 524289 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 540672 31116287 30575616 14.6G 83 Linux
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: ITY3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x92fea0b8
Device Boot Start End Sectors Size Id Type
/dev/sda1 65535 234441647 234376113 111.8G 83 Linux
mount (Iāve removed irrelevant entries)
# mount
/dev/sda1 on / type ext4 (rw,noatime,stripe=8191)
/dev/sda1 on /srv/openhab2-userdata type ext4 (rw,noatime,stripe=8191)
/dev/sda1 on /srv/openhab2-addons type ext4 (rw,noatime,stripe=8191)
/dev/sda1 on /srv/openhab2-sys type ext4 (rw,noatime,stripe=8191)
/dev/sda1 on /srv/openhab2-conf type ext4 (rw,noatime,stripe=8191)
/dev/sda1 on /srv/openhab2-logs type ext4 (rw,noatime,stripe=8191)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
df (again irrelevant entries removed)
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 110G 5.2G 99G 5% /
/dev/mmcblk0p1 253M 53M 200M 21% /boot
As you can see, the disk has:
- /dev/mmcblk0 containing - /dev/mmcblk0p1 (/boot) and /dev/mmcblk0p2 (original / partition before I moved it to the SSD)
- /dev/sda containing /dev/sda1 (/ partition).
So, in terms of raw disk backup config, it looks like I would just need to backup:
- /dev/mmcblk0p1
- /dev/sda
Or maybe it would make more sense to delete the now obsolete /dev/mmcblk0p2 partition from the SD card and then backup:
- /dev/mmcblk0
- /dev/sda
Iām trying to think in terms of what would be easiest to restore.
Also, the /dev/sda backup would be inefficient as only about 5.5GB of the / drive is actually in use. I was considering shrinking my root partition to, say 10GB, but then I saw the post regarding compression:
There was no follow-up from the original poster so I donāt know if this was successful for them.
Would the recommendation be to shrink the root partition or to use compression (assuming it works of course)?
In either case, what size requirement estimate would I need to specify to Amanda?
Use it myself so can confirm that is working.
Iād do both but itās no easy answer as thereās a risk of running out of space if you shrink your /
too much, but how much you need depends on your individual setup and needs.
As you donāt need to backup all of your / partition daily it shouldnāt do harm if it takes long the day you actually do.
what do you mean? the āstorage area sizeā on install ?
Just try with your existing setup and increase the corresponding value in amanda.conf if it turns out to be needed.
Thanks for the info. I set it up last night & it seems to be working OK.
By the way it looks like the ācomp-amrawā is set up as standard (I didnāt need to add it). That dumptype was created and chosen automatically for my SD card partition.
@mstormi
Is it not possible to specify single files in the disklist?
The Amanda readme file says this:
"You can specify files, directories and raw devices (such as HDD partitions or SD cards) that you want to be backed up in /etc/amanda/openhab-<config>/disklist."
I have two single files in my disklist, ā/etc/fstabā, and ā/etc/default/openhab2ā.
disklist:
[11:49:46] backup@openhab:/etc/amanda/openhab-dir$ cat disklist
openhab /dev/mmcblk0 comp-amraw
openhab /dev/sda1 comp-amraw
openhab /etc/openhab2 user-tar
openhab /var/lib/openhab2 user-tar
openhab /etc/grafana user-tar
openhab /etc/influxdb user-tar
openhab /etc/nginx user-tar
openhab /etc/letsencrypt user-tar
openhab /etc/fstab user-tar
openhab /usr/share/openhab2/addons user-tar
openhab /var/www user-tar
openhab /etc/amanda user-tar
openhab /etc/default/openhab2 user-tar
openhab /var/log user-tar
However, I get an error in the backup logfor these two files, and that particular task fails:
amanda log: (just error for /etc/default/openhab2 shown).
INFO dumper gzip pid 24280
FAIL taper "ST:openhab-dir" "POOL:openhab-dir" openhab /etc/default/openhab2 20200131095139 0 error "failed to set shm-ring"
INFO dumper pid-done 24280
INFO dumper pid-done 24280
FAIL dumper openhab /etc/default/openhab2 20200131095139 0 [dump (24283) /bin/tar returned 2]
sendbackup: start [openhab:/etc/default/openhab2 level 0]
sendbackup: info BACKUP=/bin/tar
sendbackup: info RECOVER_CMD=/bin/tar -xpGf - ...
sendbackup: info end
? /bin/tar: /etc/default/openhab2: Cannot open: Not a directory
? /bin/tar: Error is not recoverable: exiting now
sendbackup: error [dump (24283) /bin/tar returned 2]
sendbackup: error [dump (24283) /bin/tar returned 2]
INFO dumper gzip pid 24297
Output of amcheck:
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-KB OUT-KB COMP% MMM:SS KB/s MMM:SS KB/s
----------------------------------------- ------------------------- --------------- ---------------
openhab /dev/mmcblk0 0 15558144 2134898 13.7 9:30 3748.3 9:28 3758.6
openhab /dev/sda 0 117220824 27125867 23.1 78:38 5749.1 78:37 5750.7
openhab /etc/amanda 0 20 20 -- 0:01 17.6 0:00 200.0
openhab /etc/default/openhab2 0 -- PARTIAL FAILED FAILED
openhab /etc/fstab 0 -- PARTIAL FAILED FAILED
openhab /etc/grafana 0 40 40 -- 0:01 35.2 0:00 400.0
openhab /etc/influxdb 0 30 30 -- 0:01 26.5 0:00 300.0
openhab /etc/letsencrypt 0 90 90 -- 0:01 78.1 0:00 900.0
openhab /etc/nginx 0 50 50 -- 0:01 44.9 0:00 500.0
openhab /etc/openhab2 0 350 350 -- 0:01 303.1 0:00 3500.0
openhab /usr/share/openhab2/addons 0 13420 13420 -- 0:01 10656.6 0:00 134200.0
openhab /var/lib/openhab2 0 1521330 1521330 -- 0:28 54366.1 0:27 56345.6
openhab /var/log 0 371430 371430 -- 0:07 52312.3 0:06 61905.0
openhab /var/www 0 10 10 -- 0:01 8.8 0:00 100.0