LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-24-2008, 12:50 AM   #1
nawuza
Member
 
Registered: Jan 2007
Location: High Castle
Distribution: FC8
Posts: 66

Rep: Reputation: 15
Lightbulb 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?
 
Old 07-24-2008, 02:51 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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.
 
Old 07-24-2008, 03:29 AM   #3
nawuza
Member
 
Registered: Jan 2007
Location: High Castle
Distribution: FC8
Posts: 66

Original Poster
Rep: Reputation: 15
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/
or like this:
Code:
ln -s /var/lib/mysql/ /folder1/var/lib/mysql/

Last edited by nawuza; 07-24-2008 at 03:30 AM.
 
Old 07-24-2008, 07:38 AM   #4
storkus
Member
 
Registered: Jun 2008
Location: Phoenix, Arizona, USA
Distribution: Slackware
Posts: 326

Rep: Reputation: 49
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
 
Old 07-24-2008, 10:58 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
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!
 
Old 07-24-2008, 09:09 PM   #6
nawuza
Member
 
Registered: Jan 2007
Location: High Castle
Distribution: FC8
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by trickykid View Post
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!
replace the file is much better?!..what if i still want to use ln command,instead of using symlinks,is there other command that i can use to link the back up file to the originall file?
 
Old 07-24-2008, 09:18 PM   #7
nawuza
Member
 
Registered: Jan 2007
Location: High Castle
Distribution: FC8
Posts: 66

Original Poster
Rep: Reputation: 15
Question

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
the i got ln: creating symbolic link `two.txt': File exists

why can i replace the existing two.txt file to be a symlinks?!
 
Old 07-24-2008, 09:35 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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.
 
Old 07-24-2008, 11:12 PM   #9
nawuza
Member
 
Registered: Jan 2007
Location: High Castle
Distribution: FC8
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nawuza View Post
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 know the sequences of using ln. still i want to do it cause i want to learn.

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
ln: creating symbolic link `/backup/2008-07-26/var/lib/mysql/CL/CL': File exists
 
Old 07-24-2008, 11:23 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You already have a CL file on the backup server so the command fails.
 
Old 07-25-2008, 06:51 AM   #11
ynilesh
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to restore files using the restore command ? SKYNAT Linux - Newbie 2 12-28-2007 11:26 PM
What folders+files to backup for near bare metal restore c_mitulescu Linux - Server 2 04-11-2007 12:40 PM
cannot restore backup jon23d Linux - General 2 11-02-2006 06:24 PM
backup / restore 5pints Linux - Software 2 01-11-2005 10:08 AM
Backup and restore? tradewind Red Hat 2 07-02-2004 11:18 PM


All times are GMT -5. The time now is 06:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration