Filed under Web Hosting

If you are looking for a free and easy way to backup your webserver’s data, I suggest you take a look at R-fx Networks’ SysBK. This is a free script that allows you to backup files and databases from your webserver. Although it is not maintained anymore, its functionnality is so basic that there’s no need to maintain it in my opinion.

Basically what it does is that it makes gzipped tarball from a list of files and folders and packs in your databases as well. Then you can choose to store the backups on your webserver or you can transfer them through FTP or NFS.

Personnally I wouldn’t use this tool to generate a full system backup from which I’d try recover the whole operating system. I rather use it to backup my website data as well as some particular configuration files like httpd.conf. When it comes to performing a full system backup, I rather use server-side backups provided by my web hosting provider. As I am using a VPS (Virtual Private Server), it’s pretty to do so as the virtual hard drive is in fact a single file.

Before You Install And Configure SysBK

Prior to installing SysBK, I’ve setup an FTP server on my home computer using FileZilla’s free FTP Server. I’ve then added port 21 to Windows’ firewall list of exceptions. Since I use a router, I’ve configured it to redirect all traffic to port 21 to my FTP server on my local network.

Then I’ve headed over DynDNS.org and created an account so that I could use an hostname that resolves to my home computer’s dynamic IP address. When you’ve added an hostname to your DynDNS.org account, simply download and install their DynDNS Updater software on your computer. This will update your DynDNS hostname if your IP address changes.

Whether you want to store your backups locally or on a remote server, you’ll still need to create a backup directory. When SysBK performs a remote backup, it will create it locally before transfering it. On my server, I’ve create a directory named backups at the root level (/backups).

You also want to make sure you’ve got enough disk space to hold your backups.

If you’re planning on transfering your backups over FTP, you’ll the NcFTP client installed on your server. SysBK uses ncftpput to upload the backups.

How to install SysBK

Just like any other tool from R-fx Networks, SysBK has it’s own installation script so it’s pretty easy to proceed:

# wget http://www.r-fx.ca/downloads/sysbk-current.tar.gz
# tar xvzf sysbk-current.tar.gz
# cd sysbk-1.2
# ./install.sh

SysBK should then be installed in the following directories:

Install path:    /usr/local/sysbk
Config path:     /usr/local/sysbk/conf.sysbk
Executable path: /usr/local/sbin/sysbk

How To Configure SysBK

Everything is configured in /usr/local/sysbk/conf.sysbk. Open the configuration file with your favorite editor (I love using joe instead of vi). This is a sample configuration file from which I’ve remove unecessary comments. I’ve highlighted some of the most important settings.

# [ Main Config ]
#
INSPATH=”/usr/local/sysbk”
MODPATH=”$INSPATH/mod”
CNF_INT=”$INSPATH/internals/conf.internals”

MOUNT_POINT=”/backups”
BACKUP_PATH=”$MOUNT_POINT/”

MIN_DISK=”4096″

MAX_LOAD=”2″

ARC_PRI=”/bin/tar -cpzf”
ARC_PRI_EXT=”.tar.gz”
ARC_SEC=”"
ARC_SEC_EXT=”"

PRI=”16″

MD5=”/usr/bin/md5sum”
NICE=”/bin/nice”
DU=”/usr/bin/du”
GUNZIP=”/bin/gunzip”

# [ Transfer Module Config ]
#
USE_RTRANS=”1″
RTRANS_METHOD=”ftp”
DEL_AFTERTRANS=”1″

FBF_RTRANS=”0″
NCFTP_PUT=”/usr/local/bin/ncftpput”
FTP_HOST=”your.host.name”
FTP_USER=”user”
FTP_PASS=”password”
FTP_RPATH=”/$(hostname -s)”
SCP=”/usr/bin/scp”
SCP_HOST=”backup.yourhost.com”
SCP_USER=”backup”
SCP_RPATH=”/home/backup/$(hostname -s)”
PRVID_FILE=”"
# [ Backup Module Config ]
#
# HTTP
#
HTTP_BK=”1″
HTTP_PATH=”/etc/httpd”

# DNS
#
BIND_BK=”0″
BIND_PATH=”/var/named”
BIND_CNF=”/etc/named.conf”

# MySQL
#
MYSQL_BK=”1″
MYSQL_PATH=”/var/lib/mysql”
MYSQL_INIT=”/etc/init.d/mysqld”
MYSQL_PID=”/var/run/mysqld/mysqld.pid”
MYSQL_DUMP=”/usr/bin/mysqldump”
MYSQL_MYICHK=”/usr/bin/myisamchk”
MYSQL_ROOTPW=”password”

# Cpanel
#
CPANEL_BK=”0″
CPANEL_FILES=”$MODPATH/cpanel.files”
CPANEL_DIRS=”$MODPATH/cpanel.dirs”
CPANEL_LAST=”$MODPATH/.cpanel.last”

# Ensim
#
ENSIMVH_BK=”0″
ENSIMVH_PATH=”/home/virtual”
ENSIMVH_SL=”/usr/local/bin/sitelookup”
ENSIMVH_VHBK=”/usr/lib/opcenter/vhbackup/vhbackup”
ENSIMVH_VHBK4=”/usr/local/bin/vhexport”
ENSIMVH_PICKLE=”$INSPATH/internals/pickle.py”

# Custom
#
CUSTOM_BK=”0″
CUSTOM_FILES=”$MODPATH/custom.files”
CUSTOM_DIRS=”$MODPATH/custom.dirs”

You can also add custom files and directories to backup by editing /usr/local/sysbk/mod/custom.files and /usr/local/sysbk/mod/custom.dirs.

To launch SysBK, type sysbk -s . Keep in mind that the MySQL daemon will be stopped during the process.

Scheduling SysBK To Launch Automatically

Adding the following line to /etc/crontab will launch SysBK every night a midnight:

0 0 * * * /usr/local/sbin/sysbk -q

Again keep in mind that the MySQL daemon will be stopped during the process! You may want to schedule it to run at a different time.


Related Posts

Comments (0) Posted by Stephane on Tuesday, October 16th, 2007


You can follow any responses to this entry through the magic of "RSS 2.0" and leave a trackback from your own site.

Post A Comment