Dear rsync-guru's, here's a user question: I want to make sure the files transferred to rsync daemon (running on a linux kernel) are written to media I assume if rsync command returns (with 0) all data has been tranferred to rsync daemon, but it depends on the rsync daemon priority and linux pdflush daemon before the data is truly written to physical media (whatever that is). Is there a way to make the rsync daemon use sync or whatsoever to make sure the rsync command returns only if all transferred data is written to physical media. thanks in advance for any answers/insights --- N. van Bolhuis
On Tue, Nov 2, 2010 at 9:29 AM, Norbert van Bolhuis <nvbolhuis at aimvalley.nl>wrote:> Is there a way to make the rsync daemon use sync or whatsoever to make sure > the rsync command returns only if all transferred data is written to > physical media[?] >You can't delay the return, but you can ask the rsync daemon to run "sync" by using a "post-xfer exec" command. If you want that to run only for received files (i.e. if the module could be alternately used for sending files too), you'll need to also specify a pre-xfer exec command that analyzes the RSYNC_REQUEST variable, note the RSYNC_PID of any request that is for an incoming transfer, and make your post-xfer exec check if its RSYNC_PID indicates that it is a writing transfer. Alternately, you could make one module write-only and a duplicate module read-only and only put the post-xfer sync onto the write-only module. ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20101106/946509e6/attachment.html>
> On Tue, Nov 2, 2010 at 9:29 AM, Norbert van Bolhuis > <nvbolhuis at aimvalley.nl>wrote: > >> Is there a way to make the rsync daemon use sync or whatsoever to make >> sure >> the rsync command returns only if all transferred data is written to >> physical media[?] >> > > You can't delay the return, but you can ask the rsync daemon to run "sync" > by using a "post-xfer exec" command. If you want that to run only for > received files (i.e. if the module could be alternately used for sending > files too), you'll need to also specify a pre-xfer exec command that > analyzes the RSYNC_REQUEST variable, note the RSYNC_PID of any request > that > is for an incoming transfer, and make your post-xfer exec check if its > RSYNC_PID indicates that it is a writing transfer. Alternately, you could > make one module write-only and a duplicate module read-only and only put > the > post-xfer sync onto the write-only module. > > ..wayne.. >thx for your answer. defining a "post-xfer exec" command is a good idea. Btw. actually our biggest problem was a certain application reading old data (after having sent the new data with rsync). This was caused by the application itself (it didn't re-open the file). At first I though this had something to do with rsync/sync, but this isn't the case (apart from rsync making the problem more visible because of the internal/final move). --- N. van Bolhuis