Incremental backup with K3B on DVD RAM

From Blue-IT.org Wiki

Revision as of 19:51, 8 January 2012 by Apos (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Prerequisites

Programs and System

We use system with SuSE 10.1 and the K3B disk burning progam. The reasons are:

  • You can easy write scripts for k3b
  • SuSE is a well known and easy to configure distribution

For pack the date we use tar and gzip.

Backup media

Backup media are dvd RAM, because they are the only media that assure long time support for your data AND that the data is written correctly to the medium. Normal dvd media types don't assure that.

The media must be initially formatted as an incremental media. Otherwise it is not possible to burn multisession dvds!

To do

Do a real incremental backup of your data within the tar files.

Make an archive directory

To save any data you shoulf have a directory appart from your common dokuments. This directory will be burned to the disk entirely. The K3B program than assures that any new data is not burned twice to the disk.

K3b settings

This script is only working, if you prepared k3b for burning your dvd's in multisession. You should save this behaviour for the user as default. The same you should do for initially format dvd's: Choose incremental for the type of formatting. Alternativly you can use the following settings in the k3b config file located here:

.kde/share/config/k3brc

The part for dvd formatting should look like this:

[DVD Formatting]
force=true
quick format=false
writer_device=/dev/sr0
writing_app=Automatisch
writing_mode=incremental
writing_speed=0

The part for default data settings

[default data settings]
multisession mode=continue
on_the_fly=true

The part for default dvd settings

[default dvd settings]
multisession mode=continue
on_the_fly=true
verify data=true


K3b script

#!/bin/bash
# 
# www.apos.blue-it.org 2006
# 
# Backup data to dvd ram with 
#
## VARIABLES I - user dependend
#  Please change according to your system.
NAME="YourName"  # NOT more than 10 chars
FOLDER_TO_BACKUP1=/home/${USERNAME}/Desktop
BACKUP_FOLDER=/home/${USER}/Deskop
ARCHIVE_FOLDER=/home/${USER}/Archive
#
## VARIABLES II - system dependend
DVD_DEVICE=/dev/sr0
#
#
YEAR=`date | cut -d " " -f 6`
MONTH=`date | cut -d " " -f 2`
DAY=`date | cut -d " " -f 3`
TIME=`date | cut -d " " -f 4`
ACT_DATE="${NAME}_${YEAR}_${MONTH}_${DAY}"
TAR_FILE1="${ARCHIVE_FOLDER}/Backup_${ACT_DATE}_${TIME}.tar.gz"
#
## MESSAGES
#
FILES_SAVING_MESSAGE="Your files will be saved ..."
#
## PROGRAM
#  Do not edit beond this
#
mkdir -p ${ARCHIVE_FOLDER}
# Assure the dvd is not mounted
umount ${DVD_DEVICE}
# The next will ask
gnomesu eject ${DVD_DEVICE}
eject -t ${DVD_DEVICE}
rm ~/.DCOPserver_*
kdeinit &
k3b
PROJECT=$(dcop k3b K3bInterface createDataDVDProject)
tar -czvhf ${TAR_FILE1} ${FOLDER_TO_BACKUP1} | zenity --progress --title ${FILES_SAVING_MESSAG} --pulsate --auto-close
cd ${ARCHIVE_FOLDER}
chmod 0400 *
cd -
sync
sleep 3
dcop $PROJECT setVolumeID ${ACT_DATE}
dcop $PROJECT setImageID ${ACT_DATE}
dcop $PROJECT addUrl "${ARCHIVE_FOLDER}" / 
dcop $PROJECT burn