BackupPC-users

Re: [BackupPC-users] BackupPC - restore not restoring file

2016-07-06 13:36:08
Subject: Re: [BackupPC-users] BackupPC - restore not restoring file
From: Carl Wilhelm Soderstrom <chrome AT real-time DOT com>
To: backuppc-users AT lists.sourceforge DOT net
Date: Wed, 6 Jul 2016 13:35:26 -0400
On 07/06 12:26 , phil123456 wrote:
> I really dont understand the usage of backuppc_createtar
> 
> "-h host         host from which the tar archive is created"
> 
> but I want to create a restore from the master , not create a tar from a 
> remote host ...I am sorry, I really dont understand

You're on the 'master' - the backup server. The -h is how you specify which
host you want to do a restore of.

I should have been more clear about what BackupPC_tarCreate gives you - it
outputs a tar stream, which you then need to pipe or redirect into a file.

So something like:
/usr/share/backuppc/bin/BackupPC_tarCreate -h hostname -n -1 -s /var/backup/
employees.sql > employees.tar

Then run 'tar tvf employees.tar' to see if you actually have the file(s)
you're looking for. 'tar xvf employees.tar' will unpack the tarfile. There's
probably GUI ways to do this, but there are so many of them and they change
so often I can't say what to do.

The point of this exercise is to make sure you can get your files out.
Verify that you actually have your files. After that point you can worry
about fancy things like restoring files into place.

Personally, I don't allow the backup server to restore files into place.
Makes me nervous to allow the backup server to clobber files on the client
side.

It's only a couple of commands to capture the tar stream on the server side,
send it across the wire with 'netcat', then capture it on the other side
with 'netcat' and pipe the result to tar and unpack the files.

Here's a bit of documentation I wrote up a while ago on restoring files
across the wire. This is good to know because restoring files in place may
not always work for one reason or another. there may be some formatting
brokenness since I copied it as plain text out of a wiki.

===============

When restoring files from backuppc, it often happens that you want to
restore many files, and don't want to download them from the web interface,
due to limitations of bandwidth or file handling capability. For example,
some operating systems have limits on how big the files may be, and some
software may not operate on files larger than a certain size (4GB .zip
files, for example).

To bypass the user interface, use the BackupPC_tarCreate command on the
command line.


$ /usr/share/backuppc/bin/BackupPC_tarCreate --help
/usr/share/backuppc/bin/BackupPC_tarCreate version [unknown] calling
Getopt::Std::getopts (version 1.05 [paranoid]),
running under Perl version 5.8.8.

Usage: BackupPC_tarCreate [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]

The following single-character options are accepted:
        With arguments: -e -h -n -p -r -s -b -w
        Boolean (without arguments): -L -l -t

Options may be merged together.  -- stops processing of options.
Space is not required between options and their arguments.
  [Now continuing due to backward compatibility and excessive paranoia.
   See ``perldoc Getopt::Std'' about $Getopt::Std::STANDARD_HELP_VERSION.]
usage: /usr/share/backuppc/bin/BackupPC_tarCreate [options]
files/directories...
  Required options:
     -h host         host from which the tar archive is created
     -n dumpNum      dump number from which the tar archive is created
                     A negative number means relative to the end (eg -1
                     means the most recent dump, -2 2nd most recent etc).
     -s shareName    share name from which the tar archive is created

  Other options:
     -t              print summary totals
     -r pathRemove   path prefix that will be replaced with pathAdd
     -p pathAdd      new path prefix
     -b BLOCKS       BLOCKS x 512 bytes per record (default 20; same as tar)
     -w writeBufSz   write buffer size (default 1048576 = 1MB)
     -e charset      charset for encoding file names (default: value of
                     $Conf{ClientCharset} when backup was done)
     -l              just print a file listing; don't generate an archive
     -L              just print a detailed file listing; don't generate an
archive
You will need to become the backuppc user on the backup server.

To find the backup number (dumpNum), look at the web interface or in
/var/lib/backuppc/pc/<hostname> and see the timestamps on the number
directories.

Some examples of usage

This will take the last backup (number -1), the '/' share thereof, and the
'/etc' subdirectory from that share, and redirect the resulting tar stream
into a file called /var/tmp/host_example_com-etc.tar


/usr/share/backuppc/bin/BackupPC_tarCreate -n -1 -h host.example.com -s / /etc 
> /var/tmp/host_example_com-etc.tar

This example takes everything ('/') from the 'docs' share, and streams it to
netcat, where it is directed at 'server' (which hopefully has a
corresponding netcat process listening for the data).

/usr/share/backuppc/bin/BackupPC_tarCreate -n -1 -h host.example.com -s docs / 
| nc server 8888

On the 'server' side of the above example, a command like this would recieve
the data and dump it into the current directory as an unpacked tree of
files.

netcat -l  8888 | tar xvp

The data is sent across the network in 'tar' format, but is broken apart
into individual files on the recieving side.

Further Hints and Reading

A slightly more detailed explanation of BackupPC_zipCreate and
BackupPC_tarCreate:

http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=Backuppc_zipcreate



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

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
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/