Restore backup files
hello..i am done backing up my desire files by tar'ing' it.
here are the files that i backup: /var/lib/mysql/ /var/www/html/ /etc/named.conf /var/named/ /etc/httpd/conf/httpd.conf i need to back this files into another same linux box. I have an idea of writing a script which extract the files and link it with the one that are running on the other box.Didnt get what i mean?!ok let me put it this way.LINUX1 have apache,bind,mysql running on it.Then i tar all files that are related to those thing.then i copy the tarball into LINUX2 which have the same architecture. what i am going to do after that is extract the file into a directory called backup.then i link the original apache,bind,mysql related files in LINUX2 to the one in the backup. understand?!..hope you understand lads.. can anyone give an idea hw to do it? |
If box boxes are the same distro/ver and layout, then rsync is your answer.
Note that if both boxes will be running at the same time 'live', then you may need to do a few edits on box 2 before starting those services. |
ok..what if i want to use ln -s [source] [destination]?!
i extract the tarball into a folder name folder1.then i link the file in it which is : /var/lib/mysql/ /var/www/html/ /etc/named.conf /var/named/ /etc/httpd/conf/httpd.conf i link it with the original one running the the 2nd machine.but i am confuse whether the command looks like this: Code:
ln -s /folder1/var/lib/mysql/ /var/lib/mysql/ Code:
ln -s /var/lib/mysql/ /folder1/var/lib/mysql/ |
The man page for "ln" IS a bit confusing, but the idea is "ln -s <source> <destination> where -s makes a symlink (normally what you want), source is the ACTUAL file you want pointed AT, and destination is the name of the symlink AKA the pointer.
So as an example in my /usr/src directory I have "linux-2.6.23" and I want to make a symlink "linux" to it. The command is: ln -s /usr/src/linux-2.6.23 /usr/src/linux In other words, it's sort of backwards from what you would think it should work. I can also tell you from experience it's a VERY good idea to feed ln the full directory tree of both source and destination. I hope that helps. Mike |
Using symlinks is not a good idea, not a good idea. If these are going to be files cause you wanted to make an identical server by backing up on one machine and then restoring on another, it's better that these files replace the existing ones in the actual location, not with symlinks.
DONT USE SYMLINKS! |
Quote:
|
i try testing the ln command.in the same directory i create 2 text file called one.txt and two.txt.
then i link the two files Code:
ln -s one.txt two.txt why can i replace the existing two.txt file to be a symlinks?! |
The "ln" command has a manpage, or you can enter "ln --help" for the answer.
However, did you even read trickykid's post? If the original file becomes damaged, then the link on the other will become bad as well. Plus you are using a link to a networked connection inplace of a file. What if the network goes down? What if the file is read before the network is ready? You probably want to either use rsync as already suggested to keep the backup server synced to the primary. You could instead use tar to extract the backed up files from the first server and extract these files on the backup server. Even using rsync, you still want to perform frequent backups. Using either method, if there is a problem on the active server you are replicating the same problem on the second. You may need to restore a file from a previous archive. |
Quote:
the problem is below..i cannot link between the original and the backup.. Code:
[root@localhost mysql]# ln -s CL /backup/2008-07-26/var/lib/mysql/CL |
You already have a CL file on the backup server so the command fails.
|
Remove already linked file first and then link again. It can be done.
One Question : Are you going to use your second hosts as a backup server. So if your LINUX1 box goes down you can anytime come up with LINUX2. ? - nilesh. |
All times are GMT -5. The time now is 02:38 AM. |