LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-30-2018, 02:29 PM   #1
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 86

Rep: Reputation: Disabled
Restore Debian Wheezy (Any Server) from a Backup


Could anybody advise please, how do I restore a server from a tar.gz backup? I have a full server backup and my KVM virtualization was completely re-built. Now I am back in via SSH. I tried to un-tar it and restart the server, but it did not work. How do I proceed? What are the correct steps to be taken? All the files are there, un-packed OK but the system does not see it. Do I perhaps have to erase everything clean first somehow? Many thanks for any help in advance!

Last edited by Klaipedaville; 01-01-2019 at 03:19 AM.
 
Old 12-31-2018, 08:47 AM   #2
polytropos
LQ Newbie
 
Registered: Jun 2003
Posts: 26

Rep: Reputation: 0
Your hosting provider probably has its own method of doing it. E.g., one is here.
 
Old 12-31-2018, 11:58 AM   #3
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 86

Original Poster
Rep: Reputation: Disabled
Thank you for your input, polytropos. Appreciate.

Nah.. My hosting provider doesn't give a s*** They do not have/do/run any back ups at all. Their customers (us) are mainly on their (our) own. Although the provider is pretty much generous on resources and quite cheap 'unamanaged' as well.

I figured it out and solved the problem myself and I would like to share it now how to restore your server fairly quickly and easily. First, you have to re-build it of course, that is to use your provider's template of the OS you've had there before or to do the initial 'vanila' install. Now, make sure you restore your tar ball like this:

Code:
tar -zxvpf your-full-server-backup.tar.gz -C /
The last two symbols of -C and / are very important as they will move it up one level and overwrite your existing files in /etc /home and all the other directories by your back up files. Also make sure that you place your tar ball in your /root directory. You have there your /bin /etc/ /dev /lib /home /root /var and so on, so it's again very important to place it in your /root.

Further on you may run into tar issues like I did so it's going to be very useful to run it actually like this:

Code:
tar -zxvpf your-full-server-backup.tar.gz -C / > /dev/null
Thus, it will show you the errors and will help you fix them. For example in my case it said the following:

Code:
tar: ./etc/udev/rules.d/70-persistent-net.rules: Cannot open: File exists
Now, it is very simple to fix it by excluding this empty file like this:

Code:
 tar -zxvpf your-full-server-backup.tar.gz --exclude=etc/udev/rules.d/70-persistentet.rules -C / > /dev/null
Please, note that I added > /dev/null at the end there again just to see if it is going to spit out any more errors again. It did not. Therefore it was safe to reboot and voila, I was back, up, and running again. Hope it will help someone out to restore it as well. I was unsuccessfully looking for this kind of info for days before I figured it out myself by experimenting and by trial and error stuff.

P.S. If you need to exclude any more files or directories you may add more --exclude(s) like this:

Code:
 tar -zxvpf your-full-server-backup.tar.gz --exclude=etc/udev/rules.d/70-persistentet.rules --exclude=etc/something/else --exclude=etc/more-files -C / > /dev/null

Last edited by Klaipedaville; 01-01-2019 at 07:04 AM.
 
  


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
[SOLVED] backup utility in Linux Lite, will not restore backup. dmad71 Linux - Software 5 07-17-2018 07:38 AM
[SOLVED] Now I've done it - Debian dual boot (Sid, Wheezy) grub overwritten, lost Wheezy? ShaneRoach Debian 23 02-02-2014 02:28 PM
[SOLVED] Backup, shrink backup and modify MBR of backup jps1x2 Linux - General 1 12-17-2013 05:03 AM
mksysb restore - Wrong OS level for restore pobman AIX 0 12-10-2008 09:32 PM
How to restore files using the restore command ? SKYNAT Linux - Newbie 2 12-28-2007 10:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:45 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