[debian-lan-devel] Dirvish usb backup
Julien Lambot
jlambot at gmail.com
Sat May 4 23:48:58 UTC 2013
I don't think it will be easy to automate the setup because it's highly
dependent on the external hdd's hardware, so, as Andi suggested, this might
better fit within the wiki.
It's a beta version. I still have to check the retention policy, improve
the backup script error management and monitoring
- /etc/udev/rules.d/50-usb-backup
(inspired by http://bernaerts.dyndns.org/linux/54-debian-udev-backup)
KERNEL=="sd?1", ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="your
hardware ", ATTRS{model}=="your model ",
RUN+="/usr/local/bin/dirvish-usb %k"
Your hardware and your model must be replaced by values collected through:
udevadm info --name=/dev/sdX --attribute-walk | grep
"ATTRS{vendor}\|ATTRS{model}"
- plugging in the external hdd will trigger the script beneath RUN+
/usr/local/bin/dirvish-usb with the device as argument
Based on the default /etc/dirvish/dirvish-cronjob
#! /bin/sh
#
# daily cron job for the dirvish package
#
#EMAIL SETTINGS
SUBJECT="Backup Monitoring Report"
# Email To ?
EMAIL="you at yourdomain.loc"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "Greetings $EMAIL ! "> $EMAILMESSAGE
echo "This is Backup Monitor speaking" >> $EMAILMESSAGE
#DIRVISH CHECK
if [ ! -x /usr/sbin/dirvish-expire ]; then exit 0; fi
if [ ! -s /etc/dirvish/master.conf ]; then exit 0; fi
mydev=/dev/$1
mount $mydev /backup
logger "$mydev mounted on /backup"
logger `df |grep backup`
/usr/sbin/dirvish-expire --quiet && echo "expire result $?" >>
$EMAILMESSAGE && \
/usr/sbin/dirvish --vault usb-root && echo "backup /root result $?" >>
$EMAILMESSAGE && \
/usr/sbin/dirvish --vault usb-home0 && echo "backup /home result $?" >>
$EMAILMESSAGE && \
/usr/sbin/dirvish --vault usb-var && echo "backup /var result $?" >>
$EMAILMESSAGE && \
/usr/sbin/dirvish --vault usb-srv && echo "backup /srv result $?" >>
$EMAILMESSAGE && \
rc=$?
#logger "usb backup " $rc
# this should be sufficient but I didn't tested yet.
# /usr/sbin/dirvish-runall --quiet
sync
umount /backup || rc=$?
myPart=$1
myDisk=`echo $myPart | sed '$s/.$//'`
## eject $myDisk || rc=$?
/usr/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
exit $rc
- Vaults must be defined on the ext3/4 formatted external hdd:
eg.:
usb-home0/dirvish/default.conf
client: mainserver
tree: /srv/nfs4/home0/
xdev: true
index: gzip
image-default: %Y%m%d
exclude:
/lan/mainserver/home0/thome
*.mp3
*.MP3
*.avi
*.AVI
*.wmv
*.WMV
*.mpg
*.MPG
/etc/dirvish/master.conf
bank:
/backup
#Boolean
# do not cross FS boundaries
xdev: 1
whole-file: 1
exclude:
lost+found/
.kde/share/cache/*
.firefox/default/*/Cache/*
*~
.nfs*
/etc/mtab
/dev
/lib/init/rw
/srv/backup
/usr/src/**/*.o
/sys
Runall:
usb-root
usb-home0
usb-var
usb-srv
# loc-var 22:00
# loc-root 22:10
expire-default: +15 days
expire-rule:
# MIN HR DOM MON DOW STRFTIME_FMT
* * * * 1 +1 month
# * * 1-7 * 1 +1 year
# * * 1-7 1,4,7,10 1
# * 10-20 * * * +4 days
* 10-20 * * * +1 week
* * * * 2-7 +7 days
image-perm: 700
meta-perm: 600
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/debian-lan-devel/attachments/20130505/6d18041a/attachment.html>
More information about the debian-lan-devel
mailing list