I noticed that this topic appeared from time to time on the mailing list
and that one patch exists (copy-devices.diff) from a previous thread
which allowed rsync to operate with a source device file.
The patch below, when combined with the 'copy-devices' patch, allows
rsync to be operate between two device files.
In our environment this is being used, along with LVM snapshots, to
rsync Xen guest disks (LVs) from our production systems to our D/R
facility. The guest domains are, for the most part, disposable (common
configuration) and don't store "important" application/user data, so
something like DRBD was going to be overkill. We really just needed to
be able to replicate the images once a week, to keep the D/R images
up-to-date "enough". We also use the same snapshot to make a compressed
image to a local file for tape backup.
Hope someone finds this useful.
Todd.
.
This patch requires the copy-devices.diff patch, which should be applied
first. Then just ./configure && make
diff -u -r rsync-HEAD-20081115-2333GMT/receiver.c
rsync-HEAD-20081115-2333GMT-d2d/receiver.c
--- rsync-HEAD-20081115-2333GMT/receiver.c 2008-11-15
17:50:40.000000000 -0500
+++ rsync-HEAD-20081115-2333GMT-d2d/receiver.c 2008-12-04
17:01:00.000000000 -0500
@@ -38,6 +38,7 @@
extern int preserve_hard_links;
extern int preserve_perms;
extern int preserve_xattrs;
+extern int copy_devices;
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
@@ -285,7 +286,7 @@
goto report_write_error;
#ifdef HAVE_FTRUNCATE
- if (inplace && fd != -1
+ if (inplace && !copy_devices && fd != -1
&& ftruncate(fd, offset) < 0) {
rsyserr(FERROR_XFER, errno, "ftruncate failed on %s",
full_fname(fname));
Only in rsync-HEAD-20081115-2333GMT/: rsync.1
Only in rsync-HEAD-20081115-2333GMT/: rsyncd.conf.5
diff -u -r rsync-HEAD-20081115-2333GMT/syscall.c
rsync-HEAD-20081115-2333GMT-d2d/syscall.c
--- rsync-HEAD-20081115-2333GMT/syscall.c 2008-03-21
10:26:25.000000000 -0400
+++ rsync-HEAD-20081115-2333GMT-d2d/syscall.c 2008-12-04
16:56:38.000000000 -0500
@@ -35,6 +35,7 @@
extern int list_only;
extern int preserve_perms;
extern int preserve_executability;
+extern int copy_devices;
#define RETURN_ERROR_IF(x,e) \
do { \
@@ -50,6 +51,7 @@
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
+ if (copy_devices) return 0;
return unlink(fname);
}
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html