[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: backup strategies



On Tue, May 01, 2001 at 04:11:25PM -0700, Karsten M. Self wrote:
> > The cd solution probably has an advantage, since I could use the cd-writer
> > for other cd-writing too.
> 
>     http://kmself.home.netcom.com/Linux/FAQs/backups.html

Tape is GOOD thing if you have money.  For work, this is the answer and
do not look anywhere else.

Here is poor man's alternative which is better than FD.

I use following script to back up to CD-R (<$1 per 650MB, 3MB more than
enough to back up system). You may ant to back up more directories like
/var/spool

Key is to make each backed up file system to reside in different
partition so they do not go too deep (-l) into large data archive and
cache like debian mirror. getselection shall get the system back as soon
as possible.

Currently 3MB including personal CVS archive. (After tar.gz)
If someone polish this, send me a copy.  (Something like "dialog"
command to select from menu etc...)

--- Start script --- (Hack!)

#!/bin/bash
echo ====== Back-up system ===== /, /home, /var/cvs
# set volume label
date=$(date --utc +"%Y%m%d%H%M")
cdtemp=/home/ftp/cdimage
echo "Clean up $cdtemp"
rm -vrf $cdtemp/*
echo "Start back up >>>"
echo $date >$cdtemp/date
echo "dpkg --get-selection # use --set-selection later to recover"
dpkg --get-selections  | gzip >$cdtemp/dpkg-list.gz
#echo "ls-lR"
#ls -lR  / | gzip >$cdtemp/ls-lR.gz

echo -n 'Back up to image file (i), CD-R (r) or CD-RW (w).  Enter i/r/w: '
read YN
echo
if [ "$YN" = "r" -o "$YN" = "w" -o "$YN" = "i" ];  then
    echo "  Entered $YN"
else
    echo ... Oops! Stop here ; exit 1
fi
echo -n "Are you sure ? (y/n)"
read CNF
if [ ! "$CNF" = "y" ]; then
    exit 1
fi

echo 
echo Start making CD image ...
echo

# create tar file for directory limitted within each file system (-l)
tar -cvzl \
    --exclude='boot' \
    --exclude='bin' \
    --exclude='dev' \
    --exclude='proc' \
    --exclude='sbin' \
    --exclude='lib' \
    --exclude='tmp' \
    --exclude='usr' \
    -f ${cdtemp}/ROOT$date.tar.gz /
tar -cvzl \
    --exclude='ftp' \
    --exclude='Mail' \
    --exclude='.netscape' \
    -f ${cdtemp}/HOME$date.tar.gz /home/
tar -cvzl -f ${cdtemp}/CVS$date.tar.gz /var/cvs/
# create cd image no more -J
mkisofs -v -R -V "BU$date" \
    -o $cdtemp/../cd.img \
    $cdtemp

[ $YN = "i" ] && exit 1

echo
echo Start CD recording ...
echo

if [ $YN = 'w' ]; then
    OPTN="blank=fast"; echo Rewritable!
else
    OPTN=""; echo Recordable!   
fi
echo
exec nice --20 cdrecord -v -eject $OPTN speed=2 dev=0,0  /home/ftp/cd.img


-- 
~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ 
+  Osamu Aoki <debian@aokiconsulting.com>, GnuPG-key: 1024D/D5DE453D  +
+  My debian quick-reference, http://www.aokiconsulting.com/quick/    +

Attachment: pgphsK66aQIrF.pgp
Description: PGP signature


Reply to: