[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 931
  • Last Modified:

fedora backup and recovery

hello,

i have setup fedora core 3 on a dell poweredge 2600 server with internal tape backup utility. i would i set backups so that system is backed up fully everyday?

Thank you,
0
shashank3
Asked:
shashank3
  • 4
  • 4
1 Solution
 
JammyPakCommented:
Do you mean it has a tape drive, or actual tape backup software?
if you don't have some kind of backup software, then you can use scripts with the 'tar' command and cron jobs to do it...

Here's a modified version of a script that I inherited from someone...author unknown
<start>
#! /bin/sh

# defines where the report and log files are
rptfile='/root/scripts/log/daily.rpt'
logfile='/root/scripts/log/daily.log'

# defines which paths you want to backup, plus your tape device (note, this is for a scsi tape device)
common_root='/'
home_path='home'
share_paths='/usr/local/share/public /usr/local/share/projects'
tape='/dev/st0'

# Empty the report file
> $rptfile

# Backup /home, projects share and public share to tape

echo "Backup of /home and shares to tape started: `date`" >> $rptfile
echo "----------------" >> $rptfile

cd $common_root
/bin/tar -cvf $tape $share_paths $home_path/* > $logfile 2>> $rptfile

echo "Files listed in $logfile" >> $rptfile
echo "Backup of /home and shares to tape complete: `date`" >> $rptfile
echo "----------------" >> $rptfile

# this optional part does a compare after the backup is done to help confirm the backup worked
echo "Starting compare of tape to /home and shares: `date`" >> $rptfile
echo "----------------" >> $rptfile
echo "Errors encountered:" >> $rptfile
echo "----------------" >> $rptfile

cd $common_root
/bin/tar -df $tape >> $rptfile 2>&1

echo "Compare of tape to /home and shares complete: `date`" >> $rptfile
echo "----------------" >> $rptfile

# mail the report results to root
/bin/mail -s "Backup report: `date`" root < $rptfile

<finish>
Basically, that will backup /home, plus the shares defined (/usr/local/share/public and /usr/local/share/projects)...it will write a summary to a report file, and a detailed log to a log file (note the paths in there) and will write all the data to /dev/st0, assuming that is your tape device...then it emails root the report at the end.

By modifying that, you can backup anything you want. Then use cron to schedule it. Putting your script in /etc/cron.daily and making it executable will run the script every night.

To restore you can do this:
mt rewind
tar -xvf /dev/st0 <path of file to restore>

(tar -c creates an archive, tar -t will list the contents, and tar -x extracts it)
0
 
shashank3Author Commented:
great! awesome!

yes, i meant that i have a tape drive but don't know how to use it.

your script is very helpful. i was looking into using amanda which fedora provides, but this is very simple. how does this stack up against amanda?

Thank you so much.
0
 
shashank3Author Commented:
also does this automatically rewind the tape and delete everything before writing on the tape?

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
JammyPakCommented:
I haven't used amanda, so I can't really say...

you can add an mt rewind at the front of the script if you want. when I pop a new tape in my drive, it automatically rewinds it. also, there's no real need to 'erase' what's on the tape, the current archive will overwrite whatever's there so it's not accessible anymore. if you like, you can add an mt offline at the end to automatically pop the tape out too...
0
 
shashank3Author Commented:
great! thank you so much.

also i am doing full backup of the server. is this a good practise?
0
 
JammyPakCommented:
I have two separate backups...one for the 'data' which I do nightly...then the second one backs up the /etc, /root , /boot, etc and I only do that one once in a while (like after I've made changes). there are some dirs you won't want to backup, like /dev or /proc - they'll give you errors since they're not 'real files' in there...
0
 
shashank3Author Commented:
thank you.
0
 
JammyPakCommented:
cheers, good luck...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now