BackupPC-users

Re: [BackupPC-users] restore two folders at once

2014-05-20 08:32:35
Subject: Re: [BackupPC-users] restore two folders at once
From: Carl Wilhelm Soderstrom <chrome AT real-time DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Tue, 20 May 2014 08:31:07 -0400
On 05/20 11:24 , 李欣 wrote:
> Based on Carl Soderstrom's email,
> these are the steps to restore a backup by command line:
> 
> 1. create a tar file for the backup in backup server
> 2. send this new tar file from backup server to website server
> 3. untar the tar file in website server
> 4. implement the restore
> 
> Are these steps correct?

That is one way to do it. Sometimes I do it that way, depending on the
circumstances.
Usually I send the files directly to the machine I am restoring (but how to
do that that takes more explanation, and is not part of my interpretation of
the original question).


> Is there an easier way to do this job?
> I guess there is no command to restore selected files directly in
> target host like what the CGI does.

I do not restore files directly to the target using the CGI. To me, that
seems fraught with dangers.
 * Allowing direct restore means giving the backup server *write* permission
 to the machine to be backed up, not just *read* permission.
 * It is easier to make a mistake and destroy something unintended.

I do restores so rarely that I am willing to take the extra time to be sure
I am doing it correctly. So I copy files to the machine to be restored, and
then put them in place carefully. If it's just a few files that a user has
asked for, I will usually create a new directory next to the place the files
came from, restore the files to the new directory, and then let the user
arrange them.


Here's how to send files from the backup server to the server you are
restoring files to:

On the machine to be restored to:
root@server:/var/www# mkdir restore
root@server:/var/www# cd restore
root@server:/var/www/restore# nc -l 8888 | tar xvpf -

On the backup server:
backuppc@backuppc:~$ /usr/share/backuppc/bin/BackupPC_tarCreate -h
server.example.com -n -1 -s / /var/A_folder /var/www/B_folder | nc
server.example.com 8888

This will send the tar stream over the network via 'nc' (netcat) and unpack
it on the receiving side.

Test it for yourself and you will soon understand how it works.

Note that if you prefer a tar file on the receiving side, you can use 'dd'
instead of 'tar'. 'dd of=restore.tar' will give you a tar file instead of
the files within the tar stream.


-- 
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/