Carl Wilhelm Soderstrom wrote:
<some very nice text to patch my FAQ with>

Well,

I worked out Example 2 in my FAQ proposition, as that method went very well. It can even be used for Example 1 I think now :-) So maybe I just have to remove the Example 1 method ...
Read it please, thank you.

Anyway, a way to import a backup that uses the SMB transfer protocol in BackupPC is still to be discovered. I hope to get it today :-)

Meanwhile, my updated FAQ in attachement.

Regards,
--
Toni Van Remortel
[EMAIL PROTECTED]
=head1 Importing data in backups

This is a technique for importing data from a host you wish to backup with 
rsync in the future. Doing this will allow you to load your backup with much of 
the data you will need, thus avoiding transferring it over slow links with 
rsync.

=head2 Prerequisites

Before you can start with the import, make sure you ...

=over 4

=item *

... have the data at hand you want to import. Storage on USB disks, NFS shares 
or even SMB shares on a local network are some examples. The most important is 
that you can simulate your target client that you want to backup. So if your 
client is a Windows server, you should create a simulated Windows server with 
the correct shares (Samba is very good at it). If you have a client that is 
backed up through SSH, you need to set up a simulated server with SSH (this can 
be, and is advised to be, the backup server itself). More detailed examples 
below.

=item *

... have enough privileges on the simulation server to perform configuration 
tasks.

=back

=head2 Example 1 : simulating with SSH and rsync, and backing up non default 
paths

This example is quite easy. Here we will import backups that are located on the 
client in /mnt/samba/data.
The data to import is stored on a USB disk which we mount on /mnt/usbdisk.

=over 4

=item Step 1: edit /etc/hosts

We will use the backup server as simulation host, because that will give us the 
best performance.
To start, we add an entry in the servers /etc/hosts

        127.0.2.1       simulation_host

I use an address that is bound to 'lo', so you have a simple check on the 
import speed (just watch 'lo' with for example 'bmon' of 'iftop').

=item Step 2: set up a passwordless SSH login

In normal situations, the backuppc user has no home directory. It is advised to 
create one, because that will hold the users pre shared ssh keys. To keep it 
secure, we will only allow the backuppc user to use them.

        usermod -d /var/lib/backuppc backuppc

Become the backuppc user:

        su - backuppc

And create a SSH key to use for our simulation host:

        mkdir .ssh
        chmod 600 .ssh
        cd .ssh
        ssh-keygen -t rsa -f simulation_host

When ssh-keygen requests a password or passphrase, just hit enter.

Next, copy the ssh-key:

        ssh-copyid -f simulation_host.pub [EMAIL PROTECTED]

You can see we copy the key to [EMAIL PROTECTED] This will thus allow the 
backuppc user to log in as root to our simulation_host.

To tell ssh which key to use, create a /home/backuppc/.ssh/config file with 
this in it:

        Host simulation_host
                User root
                IdentityFile /home/backuppc/.ssh/simulation_host
                CheckHostIP no

Try to log in now (run this as the backuppc user):

        ssh [EMAIL PROTECTED]

You will get the question if you trust this host. Answer 'yes' and you should 
get the root prompt. If you log out from the root prompt, and try the ssh login 
again, you should get a root prompt without any further interaction.

=item Step 3: Set up the share

So now we have a passwordless login to our simulation_host, as we should have 
to our normal client (if you don't have that, follow the instructions in Step 
2, replacing simulation_host with a FQDN from your client).

On the client, we would like to backup /mnt/samba/data. So we will set that up 
on our simulation_host.

        mkdir -p /mnt/samba
        ln -s /mnt/usbdisk/client001/samba/data /mnt/samba/data

The data we want to import is located on our USB disk below some subdirectories 
(client001/samba/data). So we symlink the 'data' directory to /mnt/samba/data, 
as that is the directory that is used on the real client.

=item Step 4: Configuration of the client in BackupPC

Configure the client in BackupPC. Fill in every configuration detail like it 
will be for the rest of the backup servers life.

Set the XferMethod to rsync, and fill in the correct share name:

        /mnt/samba/data

As last option, fill in the ClientNameAlias:

        simulation_host

BackupPC will use the ClientNameAlias instead of the host name when it is used. 
That's really nice, as this allows us to simulate the backup.

=item Step 5: Run a full backup

Open up the clients home page in BackupPC, and hit the Start Full Backup 
button. BackupPC will now start a full backup over SSH to simulation_host and 
backup every file under /mnt/samba/data.

You can monitor the progress by watching the LOG file, and a bandwith monitor 
(such as 'bmon' or 'iftop') in a console on the backup server.

=item Step 6: Reconfigure the client

After the backup is done (with success offcourse), change the ClientNameAlias 
to the real address of the client.
Now you can happily run new backups with rsync, and use it's marvelous file 
transfer techniques.

=back

=head2 Example 2 : Simulating with SSH and rsync, and backing up system paths

To backup system paths (like /etc, /home), it is impossible to use the real 
filesystem of the simulation server.
But luckily, there is rsyncd!

BackupPC allows you to use rsync or rsyncd, both with about the same options. 
Because the sharenames to backup are in the same configuration option for both 
transfer methods, we will set up a local temporary rsyncd server to use as 
import source.

=over 4

=item Step 1: Edit /etc/hosts

We will use the backup server as simulation host, because that will give us the 
best performance.
To start, we add an entry in the servers /etc/hosts

        127.0.2.1       simulation_host

I use an address that is bound to 'lo', so you have a simple check on the 
import speed (just watch 'lo' with for example 'bmon' or 'iftop').

=item Step 2: Create a /etc/rsyncd.conf file

In this example we will backup /etc, /home, /opt and /var/lib.
Our local backup that we like to import, is located in /mnt/usbdisk/client001/.

So a possible rsyncd.conf file might look like this:

        hosts allow = 127.0.0.0/8
        uid = root
        gid = root
        use chroot = true

        [/etc/]
                path = /mnt/usbdisk/client001/etc
                read only = true

        [/home/]
                path = /mnt/usbdisk/client001/home
                read only = true

        [/opt/]
                path = /mnt/usbdisk/client001/opt
                read only = true

        [/var/lib/]
                path = /mnt/usbdisk/client001/lib
                read only = true

As you can see, there is an additional / at the end of the module shared.

=item Step 3: Configuration of the client in BackupPC

Configure the client in BackupPC. Fill in every configuration detail like it 
will be for the rest of the backup servers life.

Set the XferMethod to rsyncd, set RsyncdAuthRequired to 0 and fill in the 
correct share names:

        /etc
        /home
        /opt
        /var/lib

As last option, fill in the ClientNameAlias:

        simulation_host

=item Step 4: Start rsyncd in a console

The easiest way to run rsyncd temporarily, is by using a console on the backup 
server, and run something like this:

        rsync --daemon --config=/etc/rsyncd.conf --no-detach --verbose

This will result in an rsync daemon running in the foreground.

=item Step 5: Run a full backup

Open up the clients home page in BackupPC, and hit the Start Full Backup 
button. BackupPC will now start a full backup through the rsync daemon over the 
'lo' interface.

You can monitor the progress by watching the LOG file, and a bandwith monitor 
(such as 'bmon' or 'iftop') in a console on the backup server.

=item Step 6: Reconfigure the client

After the backup is done (with success offcourse), change the ClientNameAlias 
to the real address of the client. Also, change the XferMethod to rsync.
Now you can happily run new backups with rsync, and use it's marvelous file 
transfer techniques.

=back

=head2 Example 3 : simulating with SMB

TODO. Somebody?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
BackupPC-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Reply via email to