Home > Uncategorized > Developing a Simple Backup Strategy

Developing a Simple Backup Strategy

Managing Backups
The importance of good backups can never be overstated. Most businesses live or die by the data that they have created. A major priority of every administrator should be a excellent system for consistent backups. This system must be automated and all of those responsible have to be trained in backup verification and restoration.

Backup Media
There are a number of options for performing backups.

CD/DVD
One popular media for backups are CD or DVDs whether they are RW or just R. This media uses a laser with a photochemical process to write the data. The shelf life is typically longer than magnetic however there are a number of variables which change the lifetime. CD and DVD are typically cheap around $.15 for CDs and $.25 for DVDs. If you choose this media for backup it is important that you use the best media you can afford. Cheap media is not dependable and does not have the lifetime of high quality media. Mark your media with water soluble markers as permanent markers will have a tendency to damage the media. The media should be stored between 42-68 degrees F with 30-50% humidity for longest life. The biggest drawback to using this media is the limit in space.

USB
The advantages of USB are that it is easy to setup. USB media is limited by the number of writes that can be performed to the media so a time span for all USB media should be established. The two biggest drawbacks to USB are speed and limited drive size.

USB Connection with Hard Drives
Now it is possible to purchase RAID arrays set up in an external device. These provide an east excellent backup. Plug them in and develop your strategy.

Tape Drives
Tape drives have been an important source for backups for years. However, because of the higher cost for tapes, management of tapes and the lifespan of tapes, tape drives are not as popular as they once were.

Hard Drives
The fastest, most inexpensive and very reliable are hard drive backups. These are the easiest to manage and can be automated for long periods of time.

Because hard drives are the most readily available media for backups this section will cover backing up to hard drives only.

Using tar
The tar program is on all Linux systems and provides a way to create a backup of a directory quickly. The format for tar is:
tar options destination source
It is easy to get the destination and source confused so double check it. If the user mary wanted to back up her home directory to a backup partition called /bk this would be the command:
tar cvf /bk/mary_bk.tar /home/mary

Notice the options are:
c create an archive
v verbose and list all the activity
f place the archive in a file

Now if there was a system crash and mary needed to retrieve that tar file and expand it here is the command to do that:
tar xvf /bk/mary_bk.tar -C /

The options are:
x extract the files
v verbose
f read from the file
Notice that if mary lost her directory the whole thing could be restored by indicating where to restore it and that is why the / is important because it would recreate /home/mary from the / directory.

Example Situation:
In the home directory for mike there is a Data folder which contains important information. /home/mike/Data The user mike (not root) moves into the /home/mike directory and does:
tar cvf Data.tar /home/mike/Data.

The Data directory is removed so it looks like this now:
/home/mike/Data.tar
There is no Data directory. Now mike from the location of /home/mike does:
tar xvf Data.tar

home/mike/Data/
home/mike/Data/test2.odb
home/mike/Data/test3.lck
home/mike/Data/test2.lck
home/mike/Data/test.odb
home/mike/Data/test3.odb
home/mike/Data/test.lck

However, no Data file is created.

But…when mike does:
tar xvf Data.tar -C /
home/mike/Data/
home/mike/Data/test2.odb
home/mike/Data/test3.lck
home/mike/Data/test2.lck
home/mike/Data/test.odb
home/mike/Data/test3.odb
home/mike/Data/test.lck

The directory Data and contents are now restored.
-C, –directory DIR change to directory DIR

So in this example you are changing to the / directory before expanding the tar file.

Search the Contents of a tar File

If you need to find a file to backup and it may be located in a tar file you can use grep to locate it.
tar -tvf mytarfile.tar | grep myfile

Simple tar Script
This script will backup the /home directory and create a tar file with a timestamp. This will give you the ability to backup as often as needed. With the low cost of hard drives this could be a usable option.
#######################################
#!/bin/sh
# Timestamped Back Up
TIMESTAMP=`date +%Y%m%d_%H%M%S`;
echo $TIMESTAMP
tar cvf /bk/home_$TIMESTAMP.tar /home

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 56 other followers

%d bloggers like this: