#============================================================= -*-perl-*-
#
# Configuration file for Windows hosts.
# Note the slashes instead of backslashes
#
###########################################################################
# What to backup and when to do it
###########################################################################
#Array of directories to backup
$Conf{BackupFilesOnly} = ['/Documents and Settings', 'Travail'];
#Array of directories excluded from backup
$Conf{BackupFilesExclude} = '/Documents and Setings/user1/Local Settings/Temp';
###########################################################################
# General per-PC configuration settings
###########################################################################
#NetBios name of the machine
$Conf{ClientNameAlias} = 'netbiosname';
#Backup method used
$Conf{XferMethod} = 'smb';
#Verbosity level of log files
$Conf{XferLogLevel} = 1;
#Name of shares to backup
$Conf{SmbShareName} = ['C$'];
#Network user name
$Conf{SmbShareUserName} = 'Administrateur';
#Network user password
$Conf{SmbSharePasswd} = 'secret';
#Backup compression method
$Conf{ArchiveComp} = 'bzip2';
Windows Host via rsync
We'll use the method where we'll do without Cygwin. You can use the method with Cygwin, but don't install both simultaneously.
To begin, download cwrsync and install it on the Windows machine. During installation, it will create a user with a randomly generated password, leave it as is. This user is dedicated to starting the rsyncd service.
Then, go to the folder "C:\Program Files (x86)\ICW", then edit the configuration file:
path: /cygdrive/ is mandatory. Then use the letter of the drive you're interested in (here 'c'), then the folder in question (here 'share') (which gives '/cygdrive/c/share' for 'C:\share').
comment: a small comment line
read only: set it to yes, because only backuppc should access it and it doesn't need specific write permissions
hosts allow: specify the IP of the backuppc server
secret file: contains a file with logins and passwords of users authorized to connect
auth users: specifies which user is authorized to connect.
I have therefore created a specific user called backuppc on the machine and given it specific rights (security tab) to the "C:\share" folder
Now, we'll create a rsyncd.secrets file containing users and passwords. We'll need to authorize the backuppc user to connect to the rsyncd service:
The configuration is quite simple, which would give me for example: backuppc:password Once that's done, restart the 'RsyncServer' service in the services list.
On the backuppc server, the configuration of the server in question looks like this:
To backup SQL databases (MySQL for example), it's preferable to create an SQL account dedicated to backups (backuppc for example) and assign it select and lock rights on all databases:
This more tedious method has the advantage of backing up database by database which allows you to restore only the database you're interested in in case of a problem.
Additionally, it includes on-the-fly compression of your database. However, you'll need to install 7zip first (I chose 7zip for better compression).
We'll create a script that we'll place in /etc/scripts for example:
#!/bin/bashuser='root'password='password'destination='/tmp/backups_sql'mail='my@mail.com'mkdir-p$destinationforiin`echo"show databases;"|mysql-u$user-p$password|grep-vDatabase`;domysqldump-u$user-p$password--opt--add-drop-table--routines--triggers--events--single-transaction--master-data=2-B$i|7za-t7z-mx=9-si$destination/$i.sql.7z
doneproblem_text=''problem=0foriin`ls$destination/*`;dosize=`du-sk$i|awk'{ print $1 }'`if[$size-le4];thenproblem_text="$problem_text- $i database. Backupped database size is equal or under 4k ($size)\n"problem=1fidoneif[$problem-ne0];thenecho-e"Backups problem detected on:\n\n$problem_text"|mail-s"$HOSTNAME - MySQL backup problem"$mailfi
The problem here is the password in clear text. So make sure to restrict to the user who will backup:
This more tedious method has the advantage of backing up database by database which allows you to restore only the database you're interested in in case of a problem.
Additionally, it includes on-the-fly compression of your database. However, you'll need to install 7zip first (I chose 7zip for better compression).
We'll create a script that we'll place in /etc/scripts for example:
#!/bin/bash# Script for restoring hosts (last full backup) from command line.# The restored backups can be found in $RESTOREDIR (defined below),# and are to be written on tape.BACKUPPCDIR=/srv/backuppc-data
HOSTSDIR=$BACKUPPCDIR/pc
RESTOREDIR=$HOSTSDIR/restore/restore
# put the hosts/directories you do not want to restore into egrep...HOSTS=$(ls$HOSTSDIR|egrep-v'(HOST_CONFIG_FILES|restore)'|tr/" ")# or use:# HOSTS="HOST1 HOST2 REMOTE3"# no need to change anything below...DATE=$(date+%F)mkdir-p$RESTOREDIR/$DATEforHOSTin$HOSTSdo# find the last full backupNUMBER=$(grepfull$HOSTSDIR/$HOST/backups|tail-1|cut-f1)if["$NUMBER"]then# do the backup for the host$BACKUPPCDIR/bin/BackupPC_archiveHost$BACKUPPCDIR/bin/BackupPC_tarCreate/usr/bin/split/usr/bin/par2\"$HOST""$NUMBER"/usr/bin/gzip.gz0000000$RESTOREDIR/$DATE0\*fidone
2008-04-20 17:55:46 Can't create a test hardlink between a file in /var/lib/backuppc/pc and /var/lib/backuppc/cpool. Either these are different file systems, or this file system doesn't
support hardlinks, or these directories don't exist, or there is a permissions problem, or the file system is out of inodes or full. Use df, df -i, and ls -ld to check each of these possibilities. Quitting...
Check the rights etc... otherwise, if you're using encfs cryptology, then it comes from that and I invite you to follow this link
I Lost the Backup Numbers When I Want to Restore Data
If you still have your data but your backups and backups.old files are corrupted, there's still a way to recreate the backup indexing to be able to recover the data. If you want to reindex everything, run this: