分类: LINUX
2005-08-22 16:28:30
apt-get install backuppc libfile-rsyncp-perl
The installation creates a backuppc user. In order to receive emails sent to that account consider creating a .forward in ~backuppc (which is /var/lib/backuppc).
The installation process creates a backuppc system account and web login. The password for the weblogin should be changed with htpasswd /etc/backuppc/htpasswd backuppc. The password for the system account is already secure and doesn't need changing.
The BackupPC web interface is now accessible at .
$Conf{BlackoutPeriods} = [
{
hourBegin => 8,
hourEnd => 2,
weekDays => [1, 2, 3, 4, 5, 6, 7],
},
];
That's it!
calvin 0 backuppc
Now create a machinename.pl file for each machine that is to be backed up. A generic config file for a Linux box looks like this:
$Conf{XferMethod} = 'rsync';
$Conf{BackupFilesExclude} = ['/sys', '/proc', '/cdrom', '/dvd', '/floppy'];
As a general rule, don't use trailing slashes when specifying directories to exclude.
$Conf{BackupFilesExclude} = ['.Trash', '/Trash', '/automount', '/Network', '/private/var/automount', '/private/var/run', '/private/var/vm', '/private/var/tmp', '/private/tmp', 'Caches', 'CachedMessages'];
Also, if using tar on Mac OS X (which you probably won't, see below) you need to inform BackupPC that the binary is now in the usual /bin/tar location:
$Conf{TarClientPath} = '/usr/bin/tar';
Mac OS presents a problem: Many apps (e.g. Quark, Quicken) store important data in resource forks. But the versions of tar and rsync that ship with Mac OS X only support single-stream files (this may change with Mac OS X 10.4 Tiger).
Aside from ignoring resource forks there are two basic ways to deal with them. One is to use a $Conf{DumpPreUserCmd} (see below) to make single-stream copies of important files containing resource forks by using BinHex or something similar. A better approach is to make either tar or rsync resource-fork aware. Such a resource-fork aware version would simply map dual-stream files into two single-stream files.
The steps to back resource forks up using tar are:
mv BackupPC_tarExtract BackupPC_tarExtract.origThis patch was written by Craig Barratt himself.
patch -o BackupPC_tarExtract BackupPC_tarExtract.orig BackupPC_tarExtract.diff
chmod 755 BackupPC_tarExtract
$Conf{TarClientPath} = '/usr/bin/xtar';
Currently (2005-01) rsync is not an option. Andrew Reynhout has created a . However the Perl rsync emulator in BackupPC does not (yet) work with it. To install the new rsync just place it in /usr/bin, rename the existing rsync (e.g. to rsync_Apple) and make a symlink named rsync to the new version. Fix up the permissions and you're set.
marshmallow:/usr/bin root# ls -alF | grep rsy
lrwxr-xr-x 1 root wheel 23 15 Aug 22:56 rsync@ -> rsync-2.6.2+hfsmode-1.1
-rwxr-xr-x 1 root wheel 625696 15 Aug 22:54 rsync-2.6.2+hfsmode-1.1*
-rwxr-xr-x 1 root wheel 211860 9 Aug 16:08 rsync_Apple*
$Conf{XferMethod} = "rsyncd";
$Conf{RsyncdUserName} = "BackupPC";
$Conf{RsyncdPasswd} = "******";
$Conf{RsyncShareName} = "cDrive";
$Conf{BackupFilesExclude} = ['/winnt/tmp', '/pagefile.sys', '/hiberfil.sys', 'Temporary Internet Files/', '*Cache/', 'Thumbs.db', 'IconCache.db', '~*', 'desktop.ini', 'NTUSER.DAT', 'USRCLASS.DAT', '/RECYCLER', 'Virtual Machines/'];
Alternatively smbclient can be used to access a standard Windows share. Simply replace the rsync config lines with these:
$Conf{XferMethod} = 'smb';
$Conf{SmbShareName} = 'C$';
$Conf{SmbShareUserName} = 'BackupPC';
$Conf{SmbSharePasswd} = '******';
Note that there's a major limitation with this approach: it doesn't let you properly exclude files. You can only specify a single exclude and you don't have full regular expression support. I found that to exclude directory "foobar" I had to use $Conf{BackupFilesExclude} = ['?foobar']; (foobar by itself or anything I could think of using or / didn't work).
The smb approach seem to also require much more RAM than the rsync method. Backing up lots of files with smb has been seen to cause the Linux kernel to start killing random tasks.
If you must use smb you might be better off mounting the remote file system beforehand and then backing up with tar as if it were part of the localhost backup.
The is a good resource. The most important thing it mentions it to try running
sudo -u backuppc /usr/share/backuppc/bin/BackupPC_dump -v -f tomatoin order to view the full output of a verbose backup session on the command line.
Administrators (RIAAdministrators)Also "Backup Operators" don't have permission to read the user folders inside "Documents and Settings". If you made the BackupPC account a Backup Operator instead of an Administrator and want to back up those folders add a Backup Operators (RIABackup Operators) entry with the permissions to Read & Execute, List Folder Contents, Read.
Inherit Allow all except special permissions
CREATOR OWNER
Inherit Allow special permissions
Lorrin (RIALorrin)
Inherit Allow special permissions
Note: this gets set to the CREATOR OWNER. So for C:
it defaults to Everyone instead of a specific user.
SYSTEM
Inherit Allow all except special permissions
Users (RIAUsers)
Inherit Allow Read & Execute, List Folder Contents, Read, special permissions
The authenticity of host 'calvin (192.168.123.3)' can't be established.Either manually ssh from backuppc's account to the host to be backed up or manually add the hosts info to ~backuppc/.ssh/known_hosts.
RSA key fingerprint is 0b:b2:fa:54:64:05:2c:6a:41:e5:1d:e5:4a:f4:a6:8d.
Are you sure you want to continue connecting (yes/no)?
This can also happen if you're accidentally backing up mounted remote volumes that are on a slow WAN and take impossibly long to traverse.
You'll also see this if you forget to install rsync on the client. :-)
Check the $Conf{ClientTimeout} setting; it's meant to be the timeout between signals of life during the backup process but in certain cases acts as a timeout for the entire backup operation. The default is only 7200 seconds (2 hours) and a backup can easily need more time than that.
Also consider breaking the backup into smaller pieces. That requires two steps in the host's .pl file:
$Conf{RsyncShareName} = ['/', '/var/documents', '/var/media/pictures', '/var/media/music'];
$Conf{RsyncArgs} = [
#
# Do not edit these!
#
'--numeric-ids',
'--perms',
'--owner',
'--group',
'--devices',
'--links',
'--times',
'--block-size=2048',
'--recursive',
#
# If you are using a patched client rsync that supports the
# --checksum-seed option (see ),
# then uncomment this to enabled rsync checksum cachcing
#
#'--checksum-seed=32761',
#
# Add additional arguments here
#
'--one-file-system',
];