Strona główna / Społeczność / Blog

Once, after server crash, I've noticed I've BackupPC shows no backups for some clients. Fortunately /BackupPC/pc/*/ still contains those backups.

To fix a corrupted backups file you should:

  • Stop BackupPC
  • Run BackupPC_fixupBackupSummary script as backuppc user
  • Start BackupPC

Now I can see all backups on Host Summary page.

To backup running QEMU/KVM machine I use script made by Daniel Berteaud. I've installed it in this way:

as you can see current version is 0.2.17-1

There is also a fork of virt-backup: github.com/vazhnov/virt-backup.pl - it's based on some earlier version.

Example command to backup centos-test machine (name shown by virsh list) to /mnt/backups directory.

To backup embedded systems, such as Android phone or OpenWRT router you can use tar command in conjunction with ssh. As I mentioned before this method is almost successful with Android. Now example with Gargoyle router - called device.

Similar to Android devices OpenWRT's tar doesn't support --totals option, so I've prepared wrapper (see below) because it is necessary for BackupPC.

You will need:

  1. Copy your generated earlier id_rsa.pub to /etc/dropbear/authorized_keys on device. To be able to login without password.
  2. Login to device manually for the first time (to add it to known_hosts):

    as you can see I logged as root to device named router. Alternatively you can manually edit known_hosts.

  3. On device create file (ie. /root/tar_totals.bash) to emulate --totals option behaviour:

    and of course make it executable:

    (this what I can't do on Android)

  4. Define host in BackupPC with settings:

    as you can see only /etc is copied, and I use wrapper instead of tar command.

Now you can backup it. Of course in log you will have:

where you can see fake transfer summary.

Unfortunately on Android device you cannot set file as executable:

After you manage to ssh to your android device. You can set it up to backup with BackupPC.

Since rsync command is not available You can use tar. In configuration you have to set:

change path to tar:

and command to execute:

as you can see I've removed -l root and --totals.

Complete config is:

There are still some problems because backup is ended with an error:

You can backup android phone/tabled (device) with rsync installed on some host and SimpleSSHD installed on device.

First you have to check if you can ssh to device:

To login first time You have to run SimpleSSHD and press START to run it in foreground. From some host login to device using command:

enter password displayed in SimpleSSHD windows on device, you will see something like this:

As you can see my device has address 192.168.1.241 and server is using his default port 2222. You don't have to provide any user name (ie. -l someuser).

Now you can backup device manually using rsync:

Another approach is to use Rsync Wrapper by Letscorp (I didn't tested it yet).

The main target is to make android device be able to backup using BackupPC.

The easiest way to restore files from BackupPC is web interface, but if You are desperated to use command-line style You can try this:

where:

  • backuppc (after su) - name of user BackupPC is running as
  • /opt/BackupPC/bin - path where BackupPC is installed
  • myLaptop - name of host in BackupPC (usually DNS name)
  • 23 - backup number you want to restore (can be relative ex: -1)
  • / - is share name
  • etc - directory you want to restore (relative to share name)
  • /tmp/etc.tar - file with restored files

Of course usually You will compress this file:

Detailed information on BacpupPC documentation page.

To allow backuppc user to send emails I've to change permissions to /etc/msmtprc file:

Now I can send email as backuppc, but there is a problem with logging:

(after "this is a test") you have to press Ctrl-D (end of file).

If you have to rename host in BackupPC you have to:

  1. Stop BackupPC service:
  2. Change the host name in host file (/etc/backuppc/hosts) to new name
  3. Rename the pl file in pc folder (/etc/backuppc/pc), ie:
  4. Rename directory in the backup location (I my case backup is storing in the location /data/BackupPC)
  5. Start BackupPC service
  6. Pray
  7. Check if it works

Sometimes you have to run command as user who cannot login (shell set to /bin/false, /usr/sbin/nologin or something like this) in example for testing BackupPC where backuppc user usually cannot login but you have to run ssh command manually for the first time to add host to known_hosts.

Instead of ugly copping known_host file you can run:

I think it's nicer way.

After installation (as you can see it is based on Debian)

I have to modify attributes:

Because of error:

I had to install manually missing Perl module:

To login without password I've generated keys (as root):

and copy id_rsa.pub to .ssh/authorized_keys on host I would like to backup.

Now I can ssh to that host without password (on Windows machine You have to allow Public Key exchange).

It's time to do the same for backuppc user. By default it has bash set to /bin/false so I done it manually:

Ten kto umie pisze kod, ten kto nie umie pisze książki..., albo blog.

Pon Wt Śr Czw Pt So N
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30