Added some sshfs/ssh tuning, archive prunig added

This commit is contained in:
Charlie Root 2021-06-29 12:26:11 +02:00
parent cf19166215
commit 445c049cfe
2 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,9 @@ class wmdeit_backup::borg (
$repos = $borg_repos, $repos = $borg_repos,
$scripts = $borg_scripts $scripts = $borg_scripts
) )
inherits wmdeit_backup::params inherits wmdeit_backup::params
@ -30,10 +33,15 @@ define wmdeit_backup::borg_backup
$ssh_user = 'root', $ssh_user = 'root',
$ssh_port = '22', $ssh_port = '22',
$ssh_check_hostkey = 'no', $ssh_check_hostkey = 'no',
$borg_options = $wmdeit_backup::borg::borg_options,
$weekday = undef, $weekday = undef,
$hour = '0', $hour = '0',
$minute = '0', $minute = '0',
$retain_daily = '30',
$retain_monthly = '6',
$retain_yearly = '0',
) { ) {
$scripts = $wmdeit_backup::borg::scripts $scripts = $wmdeit_backup::borg::scripts
@ -66,10 +74,13 @@ export BORG_PASSPHRASE=$passphrase
D=`date +%F` D=`date +%F`
$wmdeit_backup::borg::sshfs_cmd $sshfs_options -oStrictHostKeyChecking=$ssh_check_hostkey -oPort=$ssh_port $ssh_user@$server:/ $mnt $wmdeit_backup::borg::sshfs_cmd $sshfs_options -oStrictHostKeyChecking=$ssh_check_hostkey -oPort=$ssh_port $ssh_user@$server:/ $mnt
cd $mnt cd $mnt
CMD=\"$borg_cmd create ${repo}::$title-\${D} $backup_dirs\" CMD=\"$borg_cmd create $borg_options ${repo}::$title-\${D} $backup_dirs\"
\$CMD \$CMD
cd / cd /
umount $mnt umount $mnt
PRUNECMD=\"$borg_cmd prune -d $retain_daily -m $retain_monthly -y $retain_yearly ${repo}\"
\$PRUNECMD
" "

View File

@ -12,7 +12,7 @@ class wmdeit_backup::params {
] ]
$sshfs_cmd = '/usr/local/bin/sshfs' $sshfs_cmd = '/usr/local/bin/sshfs'
$sshfs_options = '-o direct_io' # buggy sshfs driver under freebsd $sshfs_options = '-o reconnect -o direct_io' # buggy sshfs driver under freebsd
$borg_cmd = "/usr/local/bin/borg" $borg_cmd = "/usr/local/bin/borg"
} }
'Debian': { 'Debian': {
@ -32,6 +32,7 @@ class wmdeit_backup::params {
$borg_repos = "/tank/backups" $borg_repos = "/tank/backups"
$borg_scripts = "/root/borg" $borg_scripts = "/root/borg"
$borg_mnt = "/mnt" $borg_mnt = "/mnt"
$borg_options = "--nobsdflags --files-cache=ctime,size"
} }