[LUGOS] Backup
Saso Span
saso.span at siol.net
Fri Nov 7 15:48:09 CET 2003
Moja backup skripta:
/etc/cron.weekly/backup.cron
#!/bin/sh
# for FULL backups
# this backs up the important stuffs listed in ${lists} to ${BKPDIR}
# the lists *should* be in ${BKPDIR} and named <whatever>.lst
# the resulting backups will be <whatever>.<timestamp>.tgz
#
# notes:
# variables in CAPS are ok for you to set
# change the other variables if you know what you're doing
# you can get fancy in the lists... (think xargs *wink*)
# assumes /boot is usually unmounted, and has an /etc/fstab entry
# follow your security policy when setting perms on ${BKPDIR}
#
# written by razamatan
#
# DISCLAIMER: razamatan didn't write this if something goes wrong
mount /dev/hdc1 /mnt/backup
sleep 60s
BKPDIR=/mnt/backup/system # where the backups go
BOOT=sys # list that has /boot
NUMBKPS=1 # how many backups to keep
if [ ! -d ${BKPDIR} ] ; then
echo ${BKPDIR} is not a valid directory or is non-existant
fi
lists=${BKPDIR}/*.lst
ext=tgz
for list in `ls ${lists}`; do
type=`basename ${list} .lst`
if [ ${type} = ${BOOT} ] ; then mount /boot ; fi
cat ${list} | xargs tar zlcf \
${BKPDIR}/${type}.`date +%Y-%m-%d-%H%M`.${ext} >
/dev/null 2>&1
if [ ${type} = ${BOOT} ] ; then umount /boot ; fi
num=${NUMBKPS}
for evict in `ls -t ${BKPDIR}/${type}.*.${ext}`; do
if [ ${num} -le 0 ] ; then rm -f ${evict}
else num=$((${num}-1)) ; fi
done
done
umount /mnt/backup
hdparm -y /dev/hdc
Najprej mi požene in mounta moj stari hd, ter naredi backup v
/mnt/backup/system. Nato ugasne disk.
Za file list imam datoteko /mnt/backup/system/sys.lst
/boot
/etc
/home/saso
--exclude=/home/saso/documents
--exclude=/home/saso/download
/usr/local/portage
--exclude=/usr/local/portage/distfiles
/usr/src/linux/.config
/var/lib
--exclude=/var/lib/texmf
/lib/modules
Če mi gre particija v maloro, inštaliram gentoo 3rd stage install in
poženem emerge --neka-opcija world in *puf* sistem je spet tak kot prej.
Skripto sem dobil tukaj:
http://forums.gentoo.org/viewtopic.php?t=65669&start=0
Lep pozdrav
More information about the lugos-list
mailing list