--o-direct option

Jerome Haltom wasabi at larvalstage.net
Tue Feb 19 18:18:58 GMT 2008

I would appreciate the addition of this option, which would cause files
opened by rsync to be opened using the O_DIRECT flag, on Linux, at
least. Let me explain my circumstance:

I use rsync to migration VMware disk images from one machine to another
while the VM is running. This works really well: you take a snapshot of
the VM, run rsync, take another snapshot, run it again, then finally
suspend the VM and run it one last time. I can then resume the VM on the
new machine.

This works because VMware saves disks as a series of 2GB files and
creating a snapshot creates a new set of files that contain
modifications from the originals.

The problem is that during the rsync process the user's machine is
barely usable. The reason is because rsync reads these 2GB files... many
GBs of them. This causes the user's machine to repeatidly trash the page
cache. This really is Linux's fault. It should realize the relative
priority of the two apps and prevent rsync from trashing the cache. But
it doesn't.

Allowing rsync to specific O_DIRECT would circumvent the page cache
completely. Preventing the cache from being trashed.

Yes, it's a hack. But it'd be really useful!

More information about the rsync mailing list