backup2disk - create backup copies on a spare disk


backup2disk [config-dir]


In case you don't provide a configuration directory on the command line, a default of /etc/backup2disk/ is used.

Backing up filesystems on UNIX hosts (including local filesystems)

The backup is made by rsync, directories to be backed up are configured in /etc/backup2disk/volumes. The backup server must be able to log into the remote computer as user root via ssh without user intervention.

Backing up MySQL database servers

Login to the server via ssh and execute mysqldump. Configuration is in /etc/backup2disk/mySQL. The backup server must be able to log into the remote computer as user root via ssh without user intervention; the password to MySQL should be in /etc/mysql/my.cnf or ~/.my.cnf.

Backing up SMB shares(MS DOS to MS Windows 2000)

smbmount, rsync

Backing up AFS volume sets

Triggers the AFS backup system - you have to configure AFS backup tape coordinator to perform backups to disk first. Starting AFS dump is sheduled by /etc/backup2disk/afs.

Backing up Apple MacIntosh

Unluckily we did not find a practical solution for Apple MacIntosh other than exporting the UNIX-Homedirectories with netatalk and educating users to place their data there. Hopefully this situation improves with Mac OS X; installing OpenSSH and rsync schould not be too difficult then.


Backing up to a networked disk is no substitution for tape backups.

backup2disk relies heavily on passwordless logins via ssh. Make sure, your backup server is at least as secure as your file servers.

The file samba holds passwords necessary to mount SMB volumes via samba. Permissions on this file should be 0700 und it should not reside on an NFS exported directory.


Configuration files are searched in /etc/backup2disk/ or in a directory given as an optional parameter to backup2disk. There should be an example for each of the configuration files installed.

A lockfile /var/lock/backup2disk will be created to prevent running multiple instances of backup2disk.


The file excludes lists patterns of filenames not to backup. The format is as described in manual page rsync(1) under option --exclude-from=FILE.


Every line in volumes describes on combination of UNIX host and directory to save.

1. name of remote node

If this entry matches the current hostname as obtained by the command hostname, ssh will not be used - otherwise rsync will open a shh connection to the named computer.

2. directory
3. maximum age

Describes how long modified or deleted files should be kept.

4. destination of backup

Entries in each line are separated by whitespace, empty lines and lines starting with "#" are to be ignored.


First entry specifies the host computer; second entry the lifetime of the backup and the third the destination directory.


First four entrys have the same meaning as in volumes; the fifth entry gives a username with enough access rights to read all data und the sixth entry provides this users password.


Every line in afs describes on volumeset with corresponding dumplevel and destination disk. Entries in each line are separated by whitespace, empty lines and lines starting with "#" are to be ignored.










A process writing the backup directories to magnetic tape should set the lockfile /var/lock/backup2tape, to stop backup2disk from changing data. If the lockfile exists, the backup2disk terminates with return value -1.


backup2disk does backup symbolic links, but caveat, the link destination might not be known on the backup server.


Script should generate /var/log/backup2disk/ if it doesnt already exist. Generates mountpoint /mnt/smb/ with rather odd permissions.

Unsufficient error checking on rsync return codes. What is retcode 20?



Copyright (C) 2001-2016

backup2disk is distributed under the GNU public license. See the file COPYING for details. backup2disk is available from


The authors accept no responsibility for damages resulting from the use of this software and make no warranty, either expressed or implied, including but not limited to, any implied warranty of merchantability or fitness for a particular purpose. This software is provided as is, and you assume all risks when using it.


rsync(1), ssh(1), sshd(8), smbmount(8) for a discussion on passwordless ssh. for documentation on configuring the AFS backup process.