I use tar utility for incremental backups. Here are scripts I use:
Code:
#!/bin/sh
DATE=`date +%y%m%d`
BCKPDIR="/mnt/extra/backup"
VERBOSE=""
if [ "$1" = "--verbose" ]; then
VERBOSE="--verbose"
fi
if [ ! -d "$BCKPDIR" ]; then
echo "Directory $BCKPDIR doesn't exist!"
exit 1
fi
if [ -f "${BCKPDIR}/sys.snar" ]; then
if [ ! -s "${BCKPDIR}/sys.snar" ]; then
FN="${BCKPDIR}/${DATE}-sys-0.tar.gz"
else
FN="${BCKPDIR}/${DATE}-sys.tar.gz"
fi
else
FN="${BCKPDIR}/${DATE}-sys-0.tar.gz"
fi
if [ -f "$FN" ]; then
echo "File $FN already exists!"
exit 1
fi
echo "Starting system backup..."
tar -czf $FN -g ${BCKPDIR}/sys.snar $VERBOSE --exclude="proc/*" --exclude="dev/pts/*" --exclude="dev/shm/*" --exclude="mnt/*" --exclude="var/run/*" --exclude="var/tmp/*" --exclude="tmp/*" --exclude="home/*" -C / .
mv -f ${BCKPDIR}/sys.snar ${BCKPDIR}/${DATE}-sys.snar
echo "System backup ended."
echo "Reducing log files..."
find /var/log -type f -name "*.prev" -print0 | xargs -0 rm
find /var/log -type f -exec mv -f "{}" "{}.prev" ";"
echo "Reducing log files ended."
Code:
#!/bin/sh
DATE=`date +%y%m%d`
BCKPDIR="/mnt/extra/backup"
VERBOSE=""
if [ "$1" = "--verbose" ]; then
VERBOSE="--verbose"
fi
if [ ! -d "$BCKPDIR" ]; then
echo "Directory $BCKPDIR doesn't exist!"
exit 1
fi
if [ -f "${BCKPDIR}/home.snar" ]; then
if [ ! -s "${BCKPDIR}/home.snar" ]; then
FN="${BCKPDIR}/${DATE}-home-0.tar.gz"
else
FN="${BCKPDIR}/${DATE}-home.tar.gz"
fi
else
FN="${BCKPDIR}/${DATE}-home-0.tar.gz"
fi
if [ -f "$FN" ]; then
echo "File $FN already exists!"
exit 1
fi
echo "Starting /home directory backup..."
tar -czf $FN -g ${BCKPDIR}/home.snar $VERBOSE --exclude="*/Desktop/Trash/*" --exclude="*/shared/*" -C /home .
mv -f ${BCKPDIR}/home.snar ${BCKPDIR}/${DATE}-home.snar
echo "/home directory backup ended."