backup

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

rsnapshot

apt-get install -y rsnapshot

mv /etc/rsnapshot.conf /etc/rsnapshot.conf.org

cat < /etc/rsnapshot.conf
config_version 1.2
snapshot_root /media/backup/
logfile /var/log/rsnapshot.log
verbose 3
loglevel 3

cmd_preexec /bin/mount /media/backup
cmd_postexec /bin/umount /media/backup
#backup_script /usr/local/bin/backup_mysql.sh localhost/mysql/

cmd_rsync /usr/bin/rsync
# cmd_ssh /usr/bin/ssh

interval daily 7
interval weekly 3
interval monthly 1

#exclude dev/*
exclude lost+found/*
exclude mnt/*
exclude proc/*
exclude run/*
exclude sys/*

Install Obnam

Installation
wget https://raw.githubusercontent.com/panticz/installit/master/install.obnam.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

# install the latest version 
if [ "$1" == "-n" ]; then
  # add repository
  echo "deb http://code.liw.fi/debian wheezy main" > /etc/apt/sources.list.d/obnam.list
  wget -q http://code.liw.fi/apt.asc -O - | apt-key add -
  apt-get update
fi

# install obnam
apt-get install -y obnam

# config
cat < /root/.obnam.conf
[config]
repository = sftp://root@itdev/backup/
root = /var/www
log = /var/log/obnam.log
EOF

# add ssh keys
ssh-keygen
ssh-copy-id root@itdev

# backup
obnam backup

# commands
obnam ls
obnam ls --generation=2
obnam diff 2 5

# mount
apt-get install python-fuse #fuse

obnam mount --to /mnt/

Links
http://www.heise.de/artikel-archiv/ct/2013/23/170_Gut-gesichert - Gut gesichert: Verschl├╝sselte Datensicherung unter Linux mit Obnam

Ubuntu DVD-RAM

apt-get install dvd+rw-tools udftools
 
cat <<EOF>> /etc/fstab
/dev/pktcdvd/0     /media/dvdram   udf     defaults,noauto,user    0       0
EOF
 
cat <<EOF> /etc/default/udftools
DEVICES="/dev/sr0"
UDEV=true
NEWINT=true
EOF
 
/etc/init.d/udftools restart
 
/etc/init.d/udftools stop
#mkudffs --udfrev=0x0150 --media-type=dvdram /dev/sr0
sudo mkudffs --udfrev=0x0150 --media-type=dvdram --vid=mr_300dpi_1 --lvid=vid=mr_back_300_1 /dev/sr0
/etc/init.d/udftools start
eject
 
mount /dev/sr0 /mnt/
 
chmod 777 /mnt/
 
# format dvd-ram (optional)
dvd+rw-format -force=full -ssa=default /

Rsync SSH backup script

cat <<EOF> ~/privat/scripts/backup.ssh.sh
#!/bin/bash
 
nice -n 20 rsync -avze ssh --delete --exclude-from=/home/pako/.gvfs /home/pako pako@fs:/mnt/pakonb
EOF

mkBackup.sh

#!/bin/bash
 
# todo
# backup desktop (check for to big files)
# backup thunderbird
# backup firefox
# backup usb pen if connected
# add state function
 
DIRS="privat mr sts cd OpenVPN"
EXCLUDE="cd/neue_hp"
DATE=$(date -I)
TARGET="${HOME}/backup/${DATE}"
STATE=0
 
function state() {
	EXIT_CODE=$1
	FILE=$2
	if [ ! -z ${FILE} ]; then
		FILE_SIZE=$(du -sh ${FILE} | cut -f1)
	fi
 
	if [ $EXIT_CODE == 0 ]; then
		printf "%5s %5s\n" "[OK]" ${FILE_SIZE}
	else
		printf "%5s\n" "[ERROR]"
		STATE=$(($STATE + 1))
	fi
}
 
# create today backup directory
[ !
Syndicate content