On Tue, 21 Apr 2020, Spadajspadaj wrote:
Unless you really need the automatic fall-over to the next storage, you can also set up a vchanger. That way you can also control fixed number of fixed-size volumes. I prefer this approach to dynamicaly created media files but YMMV.
Yes, I thought to use something like this, in the beginning, too - but I thought, it would be more complex, thus decided for the current variant. Can you share the relevant vchanger config with me, please?
Firstly I must say that for me it was essential to have a removable storage. This is my home backup setup so I'm backing up to a usb-attached disks. I have a single USB-SATA cradle in which I'm simply changing disks so I needed a low-effort solution that I could easily keep some backups offline. I'm not sure how it would work with a permanently attached storage.
I used a howto as reference but I see that it's no longer
available. Maybe it's permanent, maybe not. Anyway, for reference,
the howto used to be here http://www.revpol.com/offsitebackups
Having said that, here goes my setup (on CentOS if it has any
significance).
First element of the config is the automount setup.
/etc/auto.master:
+dir:/etc/auto.master.d
+auto.master
/srv/backupstor /etc/auto.master.d/auto.vchanger --timeout=30
/etc/auto.master.d/auto.vchanger:
* -fstype=auto,rw :/dev/disk/by-uuid/&
With this setup I can just do a cd /srv/backupstor/UUID and the automounter should mount the drive if I know the UUID (easily obtainable by blkid).
So in case of:
blkid /dev/sda1
/dev/sda1: UUID="7B06F568090A6704" TYPE="ntfs" PTTYPE="dos"
PARTUUID="aae626c7-da6c-4707-8c91-0cb52703893c"
I just do cd /srv/backupstor/7B06F568090A6704 and am in the partition's root directory (regardless of the filesystem type - in this case it's NTFS).
Second part is the vchanger setup
/etc/vchanger/vchanger.conf:
Storage Resource = vchanger-1
User = bareos
Group = bareos
Logfile = /var/log/vchanger/vchanger-1.log
Work Dir = /var/spool/vchanger/vchanger-1
Log Level = 7
Magazine = /srv/backupstor/bde48cec-03db-4f36-bb68-dbd14455b700
Magazine = /srv/backupstor/7B06F568090A6704
Magazine = /srv/backupstor/46786fd5-4bc4-4799-aaa4-a7459bc5b603
Magazine = /srv/backupstor/881564a0-63db-4e49-8f31-9a4ccd7d5d22
bconsole config = /etc/bareos/bconsole.conf
Here you can see that I'm using four different disks in rotation.
If I remember correctly, I had to do some file rights sanitization on logfile and work dir.
And the bareos bart looks like this:
Storage daemon:
/etc/bareos/bareos-sd.d/autochanger/vchanger1.conf
Autochanger {
Name = vchanger1
Device = vchanger-1-0
Changer Command = "/usr/local/bin/vchanger %c %o %S %a %d"
Changer Device = /etc/vchanger/vchanger.conf
}
/etc/bareos/bareos-sd.d/device/vchanger1.conf
Device {
Name = vchanger-1-0
DriveIndex = 0
Autochanger = yes
Device Type = File
Media Type = Offsite-File
Label Media = no
Random Access = yes
Removable Media = yes
Automatic Mount = yes
Archive Device = /var/spool/vchanger/vchanger-1/0
}
Director:
/etc/bareos/bareos-dir.d/storage/vchanger-1.conf:
Storage {
Name = vchanger-1-changer
Address = backup1 # N.B. Use a fully qualified
name here (do not use "localhost" here).
Password = "password"
Device = vchanger1
Media Type = Offsite-File
Autochanger = yes
}
/etc/bareos/bareos-dir.d/pool/Offsite-eSATA.conf:
Pool {
Name = Offsite-eSATA
Storage = vchanger-1-changer
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 3 weeks
Recycle Oldest Volume = yes
Maximum Volume Bytes = 42949672960 # Small (40GB) easy to
move/transfer volume sizes
}
In this setup after initial disk plugin I create volumes like this:
/usr/local/bin/vchanger -u bareos -g bareos
/etc/vchanger/vchanger.conf createvols 3 104
Where 3 is a disk number (in this case if we look it up in vchanger.conf we'll see that it corresponds to /srv/backupstor/881564a0-63db-4e49-8f31-9a4ccd7d5d22 (units are numbered from 0)) and 104 is number of volumes to create.
Initially the volumes are created empty and can grow to Maximum Volume Bytes so in this case it's a 4TB drive.
It's supposed to perform a label command automaticaly but for some reason it wasn't working too god for me and I dind't have much time to debug it so after creating volumes I run bconsole and do "label barcodes".
After that the only commands I use after the initial creation of volumes are mount and update slots. Just keep in mind that the volume name is one off vs. slot number in vchanger. So if the console message wants you to, for example, mount volume vchanger-1_1_0030 you have to mount slot 29.
Hope this makes some sense :-)
If you have any more questions don't hesitate to ask. I might be
able to recall something back from when I deployed this.