mylvmbackup-discuss team mailing list archive
-
mylvmbackup-discuss team
-
Mailing list archive
-
Message #00050
patch
Hello,
I added a few lines to mylvmbackup so it could support the rdiff-backup tool. This was very useful for me because rdiff-backup is really good at diffing large binary files, unlike rsync / rsnap. So I am able to get very efficient backups this way.
The patch follows, comments welcome. I am not a perl developer and I basically just copied off the code for the other backup types, so probably there are improvements that could be made for option handling, etc. It's very small and only requires that rdiff-backup is installed. Hopefully this will be useful to others?
Christopher Hawkins
-----------------------------
--- mylvmbackup.orig 2009-09-05 09:44:23.000000000 -0400
+++ mylvmbackup.new 2009-12-07 10:21:03.000000000 -0500
@@ -244,6 +244,7 @@
if ($backuptype eq 'tar') {$backupsuccess = do_backup_tar()}
elsif ($backuptype eq 'rsync') {$backupsuccess = do_backup_rsync()}
elsif ($backuptype eq 'rsnap') {$backupsuccess = do_backup_rsnap()}
+ elsif ($backuptype eq 'rdiff-backup') {$backupsuccess = do_backup_rdiff()}
else {$backupsuccess = do_backup_none()};
if ($backupsuccess == 1)
@@ -575,6 +576,23 @@
return run_command("create rsnap archive", $command);
}
+## Add support for rdiff-backup
+sub do_backup_rdiff
+{
+ my $destdir = $backupdir;
+
+ log_msg ("Archiving with rdiff-backup to $destdir", LOG_INFO);
+
+ # Trailing slash is bad
+ my $relpath_noslash = $relpath;
+ $relpath_noslash =~ s/\/+$//g;
+
+ my $command = "rdiff-backup -b --force --print-statistics $mountdir/$relpath_noslash $destdir/";
+ return run_command("create rdiff-backup archive", $command);
+}
+
+
+
sub do_backup_rsync
{
my $destdir = $archivename;
@@ -792,7 +810,7 @@
--prefix=<prefix> Prefix for naming the backup (def: $prefix)
--suffix=<suffix> Prefix for naming the backup (def: $suffix)
--backupdir=<dirname> Path for archives (def: $backupdir)
- --backuptype=<type> Select backup type: none, rsnap, rsync or tar
+ --backuptype=<type> Select backup type: none, rsnap, rsync, rdiff-backup, or tar
(def: $backuptype)
--configfile=<file> Specify an alternative configuration file
Follow ups