|
|
This document is available in: English ChineseGB Deutsch Russian Turkce |
by S. Parthasarathy (Partha) (homepage) About the author: Partha is an aggressive supporter of Linux and all that stands for freedom and liberty. He fell in love with a lovely German -- when he was in Germany on a sabbatical visit. His lover, SuSe Linux, spends almost 17 hours a day with him every day. Together, they have made many many children : his "teaspoon" CDROM, his training course on Linux, his documents archived with LDP, and a whole lot of tutorial material, are all the results of this happy marriage. Dr. Partha plans to make many more children, and is working hard at this goal ! He has no intentions of using any family planning methods. For a full report about Dr. Partha's Linux contributions and activities, click here. Content: |
shivalik -- simple configuration backup (defying Murphy's laws)Abstract:
There are a whole lot of HOWTOs out there which tell you what
to do if you have a serious problem with your Linux
installation. Good for us. But there is no one there who told
you what you should do before disaster strikes you !
Here is a simple but not so short shell script which may reduce
your miseries. Run it once as soon as you install your Linux
system and run it every time you make major changes in your
system. You can even tinker it a little and make it run as a
cron job every so many hours. And then, you can sleep in peace.
Like the saying goes -- you must lock your stables
before the horse is lost. |
The BASH-shell-script : "shivalik" is a convenient way to make backups of essential files and information about your Linux installation. The script is profusely documented. It does not modify (or delete) any of your files or directories. It creates a well- protected backup of some essential files and information. The entire script is available for you to browse and understand its working (you can even modify shivalik if you want).
The script makes a backup of essential configuration files (/etc) and stores some information from the /proc filesystem in a text file called proc_info.txt (e.g which kernel modules are loaded, which partitions are mounted where, how much disk space is available).
Download shivalik-2.0.gz now (check also my homepage for future updates of the script)
After downloading the script:
To execute the script:
First, make sure that you have made the script executable
(chmod 700) as desribed above (by root only)
Now you can execute (run) the above script -- just type
shivalik /usr/local/backupcfg/ .
Remember you must be "root", to execute shivalik, because many
of the files being saved need root permissions and the script
itself is executable by "root" only.
Remember, the shivalik script is not a tool for
complete backup and recovery. Ideally, the best thing to do
would be to make a verbatim copy of your entire Linux
installation along with all files and directories. This is not
always possible, necessary, or advisable. The next best thing
would be to take a backup of the most essential information and
files. The shivalik script achieves this for you. The
script creates a subdirectory below the directory which you
specify on the command line (e.g
/usr/local/backupcfg/backup-2004-04-17_2029). This
sub-directory is named after the date and time when you create
the backup.
To be absolutely prepared for any eventuality, you can copy
the entire backup-YYYY-MM-DD_HHMM on a removable medium,
as soon as the script is executed.
In the event of any problems later, you can reconstruct the damaged configuration files from /etc by copying the files you have backed up. Do not untar the backup-YYYY-MM-DD_HHMM/etc.tar.gz to /etc as this would overwrite all files. Instead go to some other directory e.g /root and untar there. Then pick file you are interessted in and compare it with what you have in /etc (diff). You can also check the modification times of the files as tar preserves timestamps and permissions. Here is an example for /etc/fstab:
cd /root tar -zxvf /usr/local/backupcfg/backup-2004-04-17_2029/etc.tar.gz Note: above line will unpack the etc tree now to the current directory. That is /root/etc diff -u /root/etc/fstab /etc/fstab
The structure of the backup-YYYY-MM-DD_HHMM directory will be as follows:
etc.tar.gz -- complete backup of /etc proc_info.txt -- selected information from /proc (modules dma interrupts mounts version partitions meminfo pci)
rpm --verify --allThis will check all install files on the disk against the information in the rpm database. If you have e.g accidently deleted a file then rpm will tell you and you can just re-install ( rpm -i --replacepkgs --replacefiles rpm-package) the package.
Remember that shivalik is just a small part of a whole lot
of things which you have to do after your installation work is
complete. The post-installation procedures are now part of
LDP's mini-HOWTOs. You can download this from the www.tldp.org
or from http://algolog.tripod.com/postlnx.htm.
It is always a good idea to be prepared for any disaster.
No disaster should become a fatal catastrophe.
|
Webpages maintained by the LinuxFocus Editor team
© S. Parthasarathy (Partha), FDL LinuxFocus.org |
Translation information:
|
2004-04-20, generated by lfparser version 2.46