Looking inside device files
Tony Abernethy
tony at servacorp.com
Wed Aug 22 18:17:59 GMT 2007
Andre Majorel wrote:
>
> On 2007-08-21 05:55 -0400, Matt McCutchen wrote:
> > On 8/20/07, Andre Majorel <aym-cnysr at teaser.fr> wrote:
> > > Is there a way to make rsync look inside device files ?
> The goal is
> > > to copy the contents of a block device to a regular file
> > > incrementally.
> > >
> > > Short of that, even just getting it to dump the block
> checksums of
> > > the content a block device would help (if I know which blocks are
> > > out of sync, I can fix them with dd).
> >
> > Are the block device and the target regular file on the
> same machine?
>
> They could be. Or not. Doesn't matter.
>
> > Your remark about dd suggests that they are.
>
> Not necessarily.
>
> dd if=myfile skip=100 | ssh user at host "dd of=myfile
> seek=100 conv=notrunc"
>
> > If so, why do you want an incremental copy? It does at
> least as much
> > disk I/O as an ordinary copy (since it reads the entire
> basis file),
> > and the reduction in data passed from the sender process to the
> > receiver process is irrelevant.
>
> Sometimes, you need to copy a whole block device and you
> can't just cat it to wherever you want, go out to lunch and
> expect it to work.
>
> The destination could be unreliable. The network could be
> unreliable. The source could trigger DMA timeouts and lock up
> the bus, forcing you to reboot. Many things can and do go wrong.
>
> In those situations, you need to be able to verify that the
> copy is identical to the original and where's it's not, fix
> it (NOT start over, because if it failed the first time, it
> may fail the second time).
>
> rsync already has most of the mechanisms to do that easily
> and efficiently. It would be even better if it could complete the copy
> *first* and check the beginning *second* but that's probably
> more involved.
>
> > Anyway, the attached patch for the current CVS rsync adds an option
> > --copy-devices that makes rsync copy the contents of source device
> > files as if they were regular files. I tested the option on my
> > computer to copy a block device to a regular file locally, and it
> > seemed to work. Wayne, you might like to include this patch in the
> > patches/ dir of the source distribution.
>
> Thanks for the patch. I hope something like that goes in. I
> understand rsync was not meant as a block-device-level copy
> tool, but since it already has most of what it takes, it's tempting.
>
Could be extremely useful (in some cases)
but beware of rsync of /dev/zero and friends
One very useful stunt is an
rsync that takes a reasonable amount of time
followed immediately by an
rsync that takes a very short amount of time
??an offsite full-disk-backup of a moving target almost feasible??
More information about the rsync
mailing list