Rsyncing of block devices to a remote file

Dave Dykstra dwd at
Thu Jan 23 20:43:00 EST 2003

I'm not sure why it would really need to know the size, but given that
it wants it, can you open the file and lseek to the end of it?

- Dave Dykstra

On Thu, Jan 23, 2003 at 09:17:04AM +0100, David Heremans wrote:
> Hello,
> I'm looking for some assistance in modifying the rsync code
> Situation: I used to back-up some of my (unmounted NTFS) disk partitions
> remotely using the following shells construct:
> dd if=/dev/hda1 | gzip | ssh me at backupmachine 'cat >
> /backup-dir/hda1-backup.gz'
> But now I want to use rsync for this, since transfering 10 gig takes a litle
> to long if a file of a few kB has changed :-). I looked trough the archive
> and found an old mail talking about the same problem, and a response
> explaining the problem of writting to a block device (since rsync writes a
> copy file and then moves it over the original). But the same mail also said
> that reading from it should be trivial, so I set out trying to implement
> this.
> So I created a '--read-block-file' option in options.c and avoided the
> 'skipping non regular file' message in generator.c
> By altering all this the receiver is ready to get the data, but in the flist
> structure it still says that '/dev/hda1' is still a devicefile 
> and that the size is 0, and so the sender does send over zero bytes
> Now here is the problem : How do I get the size of partition in this
> datastructure ? Or more generique, how would I handle this for /dev/fd0,
> since you can insert 1.44MB disks or 720kB disks ?
> Anybody else tried to read blockdevices over rsync already ?
> After all, sending the data of a block device doesn't seem to be as trivial
> as the archived mail sugested :-)
> David 

More information about the rsync mailing list