Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can i restore from a backup.tgz file generated from another linux server on my own server? I tried the command the following command:

tar xvpfz backup.tgz -C /

The above command worked, but it replaced the existing system files which made my linux server not to work properly.

How can i restore without running into trouble?

share|improve this question

4 Answers 4

up vote 1 down vote accepted

You can use --skip-old-files command to tell tar not to overwrite existing files.

You could still run into problem with the backup files, if the software versions are different between the two servers. Some data file structure changes might have happeneed, and things might stop working.

A more refined backup process should be developed.

share|improve this answer

Unless otherwise specified The tar utility will extract files into the original tree within the current directory so for example in you are in /home/antonio/recovery and you issues the command

tar xvpfz backup.tgz

the files would be recovered into /home/antonio/recovery...

If you use the -C option this tells tar to change directory and to extract the files into a tree rooted there e.g.

 tar xvpfz backup.tgz -C /tmp 

would tell tar to change to /tmp and extract the files into /tmp/....

share|improve this answer
    
i understand the tar utility very well, but in a situation whereby i want to recover a backup from another redhat linux server to my redhat linux server, i run into problem, maybe because our system properties. How do i recover the backup.tgz to my "/" without running into trouble. –  Antonio Alimba Jun 9 at 14:05

Tip: Maybe you don't want to restore everything, just a file or a directory.

Use this command to view the contents of the backup:

tar -tzf backup.tgz | grep toys.db (or whatever you are looking for)

and suppose it returns something like this: ./home/myname/play/toys.db

To restore it you could: tar -xvpzf backup.tgz -C /tmp ./home/myname/play/toys.db

share|improve this answer

ascii files can be recovered by

  • go to single user mode. grep -ib "filename'
  • /dev/whateverpartion_name > /tmp/somefile

view /tmp/somefile and see what you want to copy over from /dev/ to original location.

if you are on ext2 mount, may be you can try recover command.

my two penny advice for future :please always read man page for command and arguments before you actually run.

share|improve this answer
1  
While the info is not wrong per se, it does not pertain to the question directly. –  Felix Frank Jun 9 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.