Continued from Page 2
How you back up is also dependent on how your file systems are laid
out. The most trivial case is where the root file system has all the system areas (/var,
/usr, /sbin, /etc, /dev, /lib, /boot and /bin), and the other file system is the user file
system (typically named /export, /home or /users). In such a situation, contents of the
user file systems will be backed up more frequently when compared to the root file system.
When you back up the root file system, you may have non-critical data like the cache area
of the web/ftp proxy-cache, which you may want to exclude from the backup.
I use tar effectively and would advise you to do so too. tar
(expands to tAPE arCHIVER) is used for archiving on tape. Here’s an example of
creating a compressed tar archive of /usr/doc/HOWTO excluding the "mini"
directory:
# cd /usr/doc/HOWTO; tar —exclude mini -zcvf
/tmp/x.tar.gz .
Note that the source file list is specified as the current directory
".". A common mistake users make here is to use "*" which contradicts
the exclusion and overrides it. The destination file can be written to tape by replacing
/tmp/x.tar.gz by the local or remote device name. Note that the archive will not contain
the leading path names since we have descended to that directory. Replace "mini"
and "." with the pathnames "/usr/doc/HOWTO/mini" and
"/usr/doc/HOWTO", respectively. Again, tar will strip the leading "/"
in this pathname in the tar archive. Use the -P option of tar to retain the leading
"/".
Here’s how to back up files that have changed after a
particular date, using the -N option of tar. You would use this option to back up config
file changes in the systems areas or to perform a daily backup of user areas. The example
shows how to back up changes on the user file system since the Valentines day.
# cd /export/users/; tar -zcv -N "Feb 14 17:30:32 1999" \?
-V "Incremental backup from Feb 14 17:30:32 1999 to Mar 1 12:00:00 1999" \? -f
/dev/st0 *
(The "\" at the end of each line implies (a \and a
) a continuation of the command on the next line. The "?" is the
secondary prompt that Linux gives by default to signal a continuation. You could continue
to type the command without having to give these command continuations.)
The -V option allows you to tag a volume label to the tape archive.
Having seen the various options, let’s now construct a backup
strategy. We’ll assume that you toy around less with your system areas. As soon as
you install the system, configure and customize it to your requirements, it’s time to
take an incremental backup of the system area. You may or may not want to take a complete
backup of the system area just after installation—you have it on your distribution
anyway. You could repeat such incremental backups either after each change you make to the
system config files (recommended), or periodically, say every fortnight. You could make
the increment either from the date of install or from the last incremental backup date.
The former would not allow you to record a history of changes whereas it’s faster
when it comes to restoring the state in case of a crash; one extract would bring it to the
state before the crash.
Page(s) 1 2 3 4 5 |
|