On Friday 06 Jun 2003 19:35, Mark Knecht wrote:
> Hi,
>    I've got a number of 1394 hard drives. I'd like to set up some
> sort of a regular backup of my Gentoo box in the studio. Can someone
> recommend a tool that has an ebuild and will support backing up to a
> hard drive?
>
>    I prefer a GUI based tool, or something very easy to remember how
> to use if it's command line based.
>
Jason Calabrese <[EMAIL PROTECTED]> posted a nice script here 
recently.  It uses tar and is based on a backup disk dedicated to 
backups, big enough to hold several.

I was so impressed I got myself a 160GB disk and adapted the script as 
follows.  My complete backup (including Windows 98) is about 12GB so I 
can get about 9 or 10 full backups on that disk and they only take an 
hour on a cron job.  Although the disk is nominally 160GB, when 
formatted single partition the partition size is 127GB.

==================================================================
#! /bin/bash
# /usr/local/bin/backup
#######################
# Backup Script
#######################
# Jason Calabrese <[EMAIL PROTECTED]>
# modified by Peter Ruskin <[EMAIL PROTECTED]> 01-Jun-03

BACKUP_TO=/mnt/backup
FILE=$BACKUP_TO/`hostname|cut -f1 -d.`-`date +"%F-%H%M"`.tar
FILE_LIST=$BACKUP_TO/`hostname|cut -f1 -d.`-`date +"%F-%H%M"`.list
OLD_FILE=$BACKUP_TO/`hostname|cut -f1 -d.`-`date --date='9 days ago' 
+"%F"`
EXCLUDE='--exclude /mnt/.init.d --exclude /mnt/backup --exclude 
/mnt/cdrom --exclude /mnt/floppy --exclude /mnt/KROH-LIESE --exclude 
/mnt/KROH-PETER --exclude /mnt/PENGUIN --exclude /proc --exclude 
/usr/portage/distfiles'

echo "   Mounting boot partition..."
mount /boot -o ro
echo
echo "   Mounting backup disk..."
mount $BACKUP_TO
sleep 4
echo

echo "   Removing old archives..."
echo
/bin/rm -f ${OLD_FILE}*.tar
/bin/rm -f ${OLD_FILE}*.list

echo "   Performing backup - it'll be an hour or so..."
echo
/bin/tar -cpvvf $FILE / $EXCLUDE > $FILE_LIST

echo "   Backup finished at `date +'%H:%M'`"
echo

USEDSPACE=$(du -h $BACKUP_TO | grep G | awk '{print $1}' | cut -f1 -dG)
FREESPACE=$(df | grep $BACKUP_TO | awk '{print $5}')
NUMBAKUPS=$(ls $BACKUP_TO/kroh-*.tar | wc -w | awk '{print $1}')
TOTALBLOCKS=$(cat /proc/partitions|grep 
ide/host0/bus1/target0/lun0/part1 | awk '{print $3}')
CAPACITY=$(($TOTALBLOCKS/1024/1024))
SPACELEFT=$(($CAPACITY-$USEDSPACE))
AVSIZE=$(($USEDSPACE/$NUMBAKUPS))
ESTBKUPS=$(($CAJason Calabrese <[EMAIL PROTECTED]>PACITY/$AVSIZE))

echo "   Capacity of backup partition: ${CAPACITY}GB"
echo
echo "   Space occupied by backup partition: ${USEDSPACE}GB"
echo
echo "   Space left on backup partition: ${SPACELEFT}GB"
echo
echo "   Number of backups: $NUMBAKUPS"
echo
echo "   Average size per backup: ${AVSIZE}GB"
echo
echo "   Estimated total number of backups: $ESTBKUPS"
echo

echo "   Unmounting boot and backup partitions..."
echo
/bin/umount -l /boot
/bin/umount -l $BACKUP_TO

echo "   Spinning down backup disk..."
/sbin/hdparm -y /dev/hdc                # spin down disk

# To restore a file, search for it in $FILE_LIST, e.g. etc/fstab, then:
# cd /
# tar -xpvf $FILE etc/fstab


--
[EMAIL PROTECTED] mailing list

Reply via email to