PDA

View Full Version : [ubuntu] Backup to tape drive (hp dat 72) - Which software?



anivio
July 5th, 2010, 06:43 PM
Hi!

I am a Ubuntu 10.04 Desktop user.

I am searching for a backup software to backup to my hp dat72 tape drive. It is only to backup my data from 1 PC.

I have already found bacula but it seems to big for my purpose. I need an easy and automatic software.

Could you recommend a backup software for my needs?

Thank you.

anivio

lukeiamyourfather
July 5th, 2010, 06:56 PM
I'd try this (http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/) plus cron. Cheers!

mmerlone
July 6th, 2010, 03:16 AM
Depends on your needs, but I'd suggest bacula. Enterprise grade.

lsutiger
July 6th, 2010, 04:24 AM
Wouldn't backintime work as long as it is a mounted drive? Very simple and light.
http://www.le-web.org/back-in-time/

Also in the repositories.

lukeiamyourfather
July 6th, 2010, 06:05 AM
Wouldn't backintime work as long as it is a mounted drive? Very simple and light.
http://www.le-web.org/back-in-time/

Also in the repositories.

The original poster is asking about a tape drive. Nearline is different because the system doesn't care what the endpoint is and doesn't have to do anything like rewind tapes. I think Bacula supports some tape drives. Cheers!

anivio
July 6th, 2010, 07:11 AM
Hi!

Thanks a lot for your help.

I have tried the solution which lukeiamyourfather has posted. It works but if i backup 20 GB it needs a lot of time to display the list of files on the tape backup. Thats because the drive is only a slow dat72 one.

EDIT: Maybe the logfile includes a list of backed up files. I will have a look.

I am a new ubuntu/linux user and bacula seems to have a very difficult configuration. The manual has over 600 sites.

At the moment i am not sure which solution i should use. Maybe the configuration of bacula will give me a lot of experience.

Thank you

anivio

anivio
July 6th, 2010, 08:38 AM
#!/bin/bash
# A UNIX / Linux shell script to backup dirs to tape device like /dev/st0 (linux)
# This script make both full and incremental backups.
# You need at two sets of five tapes. Label each tape as Mon, Tue, Wed, Thu and Fri.
# You can run script at midnight or early morning each day using cronjons.
# The operator or sys admin can replace the tape every day after the script has done.
# Script must run as root or configure permission via sudo.
# -------------------------------------------------------------------------
# Copyright (c) 1999 Vivek Gite <vivek@nixcraft.com>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Last updated on : March-2003 - Added log file support.
# Last updated on : Feb-2007 - Added support for excluding files / dirs.
# -------------------------------------------------------------------------
LOGBASE=/root/backup/log

# Backup dirs; do not prefix /
BACKUP_ROOT_DIR="home sales"

# Get todays day like Mon, Tue and so on
NOW=$(date +"%a")

# Tape devie name
TAPE="/dev/st0"

# Exclude file
TAR_ARGS=""
EXCLUDE_CONF=/root/.backup.exclude.conf

# Backup Log file
LOGFIILE=$LOGBASE/$NOW.backup.log

# Path to binaries
TAR=/bin/tar
MT=/bin/mt
MKDIR=/bin/mkdir

# ------------------------------------------------------------------------
# Excluding files when using tar
# Create a file called $EXCLUDE_CONF using a text editor
# Add files matching patterns such as follows (regex allowed):
# home/vivek/iso
# home/vivek/*.cpp~
# ------------------------------------------------------------------------
[ -f $EXCLUDE_CONF ] && TAR_ARGS="-X $EXCLUDE_CONF"

#### Custom functions #####
# Make a full backup
full_backup(){
local old=$(pwd)
cd /
$TAR $TAR_ARGS -cvpf $TAPE $BACKUP_ROOT_DIR
$MT -f $TAPE rewind
$MT -f $TAPE offline
cd $old
}

# Make a partial backup
partial_backup(){
local old=$(pwd)
cd /
$TAR $TAR_ARGS -cvpf $TAPE -N "$(date -d '1 day ago')" $BACKUP_ROOT_DIR
$MT -f $TAPE rewind
$MT -f $TAPE offline
cd $old
}

# Make sure all dirs exits
verify_backup_dirs(){
local s=0
for d in $BACKUP_ROOT_DIR
do
if [ ! -d /$d ];
then
echo "Error : /$d directory does not exits!"
s=1
fi
done
# if not; just die
[ $s -eq 1 ] && exit 1
}

#### Main logic ####

# Make sure log dir exits
[ ! -d $LOGBASE ] && $MKDIR -p $LOGBASE

# Verify dirs
verify_backup_dirs

# Okay let us start backup procedure
# If it is monday make a full backup;
# For Tue to Fri make a partial backup
# Weekend no backups
case $NOW in
Mon) full_backup;;
Tue|Wed|Thu|Fri) partial_backup;;
*) ;;
esac > $LOGFIILE 2>&1


I have made a backup.sh file with the above code. I have tried to execute the script (with sudo) but it does not start. I have tried the original script and a script with customized lines.

Whats wrong?

lukeiamyourfather
July 6th, 2010, 02:58 PM
I have some experience with bash scripting but I guess not enough to recognize the problem outright. Starting from the first step, how is it being launched? Does the shell return anything? Cheers!

anivio
July 7th, 2010, 08:03 AM
I have tried to launch the script via a terminal. First the original one and second one with customized lines for the logbase and the backup dirs. I have not made a exclude file.

Steps:

1) Change into the directory where the script is located
2) Start the script via "sudo bash backup.sh" or via "sudo sh backup.sh"
3) Nothing happend. No output. Only a logfile without entries

Also i have tried to launch the script via crontab. Also this does not work.

I have tried the following script https://help.ubuntu.com/8.04/serverguide/C/backups-shellscripts-rotation.html#backup-shellscript-tapedrive

This one works fine, but i have no logfile outputs.