Thursday, December 29, 2005

Rsnapshot on Fedora Linux

rsnapshot

The dependencies of rsnapshot also shows how it works.

I've been evaluating possible deployment of rsnapshot since the RAID0 catastrophe we had on our lab portal. I need an automatic backing-up scheme with historical copies on different time frames. This can prevent failing filesystem from destroying the master copy. Of course, we cannot guarantee anything without diligent monitoring the logs.

According to the website,

    "rsnapshot is a filesystem snapshot utility for making backups of local and remote systems. Using rsync and hard links, it is possible to keep multiple, full backups instantly available."
This sounds perfect to me, but I still need to dig more on the strategies we might want when backing-up our data. My concerns were mainly on availability and the efficiency because we have several hundreds gigabyte data in the lab and it's very likely to disrupt the file server availability when doing the backup. Rsync seems to be a no-brainer, and automatic rsync (rsnapshot) is even better.

There are two way to backup the data on the workstations from the backup server, you can actively push the backup to the server or suck the backup on the workstations from the server. Due to the security concerns on the workstations, opening a read-only, exclusive NFS export for the server or opening exclusive rsync access seem to be more secure.

I am not familiar securing rsync:// server at this point, and I am a little bit lazy designing new procedure in the meantime. Without hesitation, I chose to use NFS on the workstations.

In Redhat/Fedora flavored Linux, there is a default autofs rule on /net directory that can mount remote NFS volumes without writing the autofs configurations for mount points and locations. So the rsnapshot configuration is very easy under this setup, I only need to specify interval and backup rules. These are my part of configuration...

--- /etc/rsnapshot.conf.default 2005-04-09 15:59:25.000000000 -0700
+++ /etc/rsnapshot.conf 2005-12-28 22:44:36.000000000 -0800
@@ -23,7 +23,8 @@
 ###########################
 
 # All snapshots will be stored under this root directory.
-snapshot_root /.snapshots/
+#snapshot_root /.snapshots/
+snapshot_root /backup/
 
 # If no_create_root is enabled, rsnapshot will not automatically create the
 # snapshot_root directory. This is particularly useful if you are backing
@@ -49,7 +50,7 @@
 cmd_rsync /usr/bin/rsync
 
 # Uncomment this to enable remote ssh backups over rsync.
-#cmd_ssh /usr/bin/ssh
+#cmd_ssh  /usr/bin/ssh
 
 # Comment this out to disable syslog support.
 cmd_logger /usr/bin/logger
@@ -63,7 +64,7 @@
 # i.e. hourly, daily, weekly, etc.      #
 #########################################
 
-interval hourly 6
+interval hourly 3
 interval daily 7
 interval weekly 4
 #interval monthly 3
@@ -105,6 +106,8 @@
 #include ???
 #exclude ???
 #exclude ???
+exclude  'swapfile*'
+exclude  'lost+found'
 
 # The include_file and exclude_file parameters, if enabled, simply get
 # passed directly to rsync. Please look up the --include-from and
@@ -115,8 +118,9 @@
 
 # Default rsync args. All rsync commands have at least these options set.
 #
-#rsync_short_args -a
+rsync_short_args -a
 #rsync_long_args --delete --numeric-ids --relative --delete-excluded
+rsync_long_args --bwlimit=1024 --delete --numeric-ids --relative --delete-excluded
 
 # ssh has no args passed by default, but you can specify some here.
 #
@@ -145,14 +149,27 @@
 ###############################
 
 # LOCALHOST
-backup /home/  localhost/
-backup /etc/  localhost/
-backup /usr/local/ localhost/
+#backup /home/  localhost/
+#backup /etc/  localhost/
+#backup /usr/local/ localhost/
 #backup /etc/passwd localhost/
 #backup /home/foo/My Documents/  localhost/
 #backup /foo/bar/ localhost/ one_fs=1, rsync_short_args=-urltvpog
 #backup_script  /usr/local/bin/backup_pgsql.sh localhost/postgres/
 
+# NFS
+#backup /net/KOON/    QUEEN/
+#backup /net/PARTHENON/home/ PARTHENON/
+backup /net/ATROPOS/           ATROPOS/
+backup /net/LACHESIS/          LACHESIS/
+backup /net/CLOTHO/home/       KLOTHO/ 
+backup /net/MARJAR/            MARJAR/ 
+backup /net/TOKI/              TOKI/   
+backup /net/SSIZZ/home/        SSIZZ/  
+backup /net/MACHI/homedisk/    MACHI/  
+backup /net/KYO/usr/home/      KYO/    
+backup /net/AUXO/home/         AUXO/   
+
 # EXAMPLE.COM
 #backup root@example.com:/home/ example.com/
 #backup root@example.com:/etc/ example.com/
also don't forget the crontab:
0  0,8,16     * * *     rsnapshot hourly
50 23         * * *     rsnapshot daily
40 23 1,8,15,22 * *     rsnapshot weekly
30 23         1 * *     rsnapshot monthly

The foreseeable problem is the bandwidth and intensity of local I/O, that's why I use "--bwlimit=1024" to use only 1Mbps for single rsync session. Also only 3 hourly backup will be performed for one day to avoid overlapping slow backing up progress.

No comments: