Use the mirrordir util for hard-drive mirroring.You can use it make an
exact copy of the folder heirarchy.Download it from
Select a partition where you will satore your disk image.Make sure it
is big enough to hold large data.Create a directory to mount the
directory on and mount it.You need root permissions.
#mkdir -p /mirror/home
#mount /dev/hda4 /mirror/home
In this e.g,i'm mounting the 4th partition on the first disk.You may
change this according to your preference.Change drive name
accordingly(hda2,hda3 etc.)You can check your partitions with the the
command : fdisk -l.
After you type in the mount command.Now you are ready to copy the
contents of your directory.Enter the command:#mirrordir /home
This causes the contents of the home directory to be copied to the
/mirror/dir directory.Be very careful while doing this coz if you
reverse the order then the entire home dir will get deleted.Thus you
have the backup of the /home directory.You can run the mirrordir again
to update the mirrored directory.If the /home partition should crash
then you can replace the disk using the mirrored copy by typing
#mirrordir /mirror/home /home.Or you can turn the mirrored partition
into the into the actual partition by editing the /etc/fstab file and
change the device name for /home so that it matches the mirrored
directory.Now unmount and remouint the /home partition(or reboot) and
the mirrored dir will be mounted to home.
To automate the process,create a script that mounts the
mirror partition,run the mirrordir command,and then unmount the
partition.Create a script named <mirror>.h and place it in the
# mirror.sh: mMirror the /home partition to a second hard drive
/bin/mount /dev/hda4 /mirror/home
mirrordir /home /mirror/home
Now invoke the cron command with the -e opt..Add a line similar to this
at the end of the list
0 * * * * /usr/local/sbin/mirror.sh
Save and exit the editor.
It's always good to backup crucial data onto more than one source.Cd's
are a very good option.First create an image of the CDFS as a file on
your system.Invoke the mkisofs command and pass it the name of the file
sys image file to create,followed by the dir to base it on.
#mkisofs -R -o /var/tmp/user.cd /home/user
An ISo image is created in a file named user.cd in the /var/tmp dir.The
-R causes the Linux specific file permissions and file names to be
used.Burn this image onto a cd and voila!your data is now safe.
The tar command is usually used to backup onto magnetic tape drives.