[olug] Backups??

jay at reboottheuser.com jay at reboottheuser.com
Mon Mar 13 17:28:35 UTC 2006


Here's a simple example script, so you end up with individual files
under /mnt/backup/DATE_HOSTNAME/directory.tar.bz2


#!/bin/bash

DATE=`date +%m%d%y`
SYS=`uname -n`
BASE_DIR=/mnt/backup
BACKUP_DIR="${DATE}_${SYS}"
DEV=/dev/sda1

#make drive mount dir if needed
if [ ! -d /mnt/backup ] ; then
    mkdir ${BASE_DIR}
fi

#mount backup drive
/bin/mount ${DEV} ${BASE_DIR}

#check to see if it was mounted
CHECK_MOUNT=`/bin/mount | grep ${DEV}`

#if it was mounted then proceed with backup
if [ "${CHECK_MOUNT}" != "" ]; then

#make the timestamped backup directory
cd ${BASE_DIR}
mkdir ${BACKUP_DIR}

#make a backup listing of your partition layout
/sbin/fdisk -l > ${BASE_DIR}/${BACKUP_DIR}/fdisk_list

#start main backups
BACKUP_LIST="etc boot root home var "
cd /
for i in ${BACKUP_LIST}
do
         echo "tar cvfj ${BASE_DIR}/${BACKUP_DIR}/${i}.tar.bz2 ${i}"
         tar cvfj ${BASE_DIR}/${BACKUP_DIR}/${i}.tar.bz2 ${i}
done

#do extra backups
cd /usr
BACKUP_LIST="local"
for i in ${BACKUP_LIST}
do
         echo "tar cvfj ${BASE_DIR}/${BACKUP_DIR}/${i}.tar.bz2 ${i}"
         tar cvfj ${BASE_DIR}/${BACKUP_DIR}/${i}.tar.bz2 ${i}
done

#unmount drive
/bin/umount ${DEV}

else
   echo "Backup drive ${DEV} unable to mount on ${BASE_DIR}"
fi


Quoting Don Kauffman <dekauff at cox.net>:

> In case anyone is curious about the backup system I decided on, it's a
> Seagate external USB Hard Drive with 160 GB of Storage. Fairly
> inexpensive and it does the job. Now I need to figure out a script and
> cron job to automate the backups. Will do that sometime this week.
>
> Thanks for all the assistance and advice! Sorry I couldn't make it to
> the OLUG meeting on backups. My Life is nuts right now!
>
> Don K.
>
> On Mon, 2006-02-27 at 08:55 -0600, Don Kauffman wrote:
>> Since my hard drive failed and I lost most of my "life", I've become
>> keenly aware that I need a back up system. So I've got several
>> questions.
>>
>> First of all, I'd like to do an informal poll and find out what people
>> are using to back up their personal data with Linux. I figure this will
>> be of interest to others as well.
>>
>> Secondly, I'd like to know if anyone has experience using the USB Hard
>> drives as backups to their Linux data and what that experience has been.
>> I'd like to know what you had to do to get it working.
>>
>> Thirdly, I've toyed with the idea of getting an older machine and
>> putting a larger hard drive in it to serve as a backup but that seems
>> kind of iffy. Has anyone done that?
>>
>> Thanks in advance for participating in my "informal poll"! Any
>> suggestions are welcome!
>>
>> Don K.
>>
>> _______________________________________________
>> OLUG mailing list
>> OLUG at olug.org
>> http://lists.olug.org/mailman/listinfo/olug
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>






More information about the OLUG mailing list