7

I have mounted a webdav directory with davfs2 via:

sudo mount -t davfs -o uid=bruni,gid=users https://server/folder /home/bruni/mountpoint/

How can I force a sync via command line without unmounting the directory?

The client is running KUbuntu 19.10, the server is an egroupware server but this is most probably irrelevant.

mount.davfs -V                                                                                                                                                                      
davfs2 1.5.5  <http://savannah.nongnu.org/projects/davfs2>

To clarify what I mean by synchronize, I mean what umount.davfs, does before unmounting to verify that all changes have been uploaded to the server:

/sbin/umount.davfs: waiting while mount.davfs (pid xxxxx) synchronizes the cache .. OK
7
  • I don't have a davfs system to test here, but have you tried sudo sync /home/bruni/mountpoint ?
    – Zip
    Dec 23, 2019 at 1:32
  • @Zip i get sync: error opening '/home/bruni/mountpoint': Transport endpoint is not connected (the share is mounted)
    – Bruni
    Dec 23, 2019 at 9:44
  • 1
    Perhaps it is getting timeouts during the sync operation or some other issue. I suggest you enable debug as indicated in the davfs man page and retry the operations. That way you may be able to diagnose further what is happening here, as that error doesn't indicate its source cause. Edit your question with that info if possible.
    – Zip
    Dec 23, 2019 at 20:26
  • Thank you and sorry for answering so late. I have enabled debugging. Strangely 'sudo sync /home/bruni/mountpoint' no longer returns an error. It returns nothing at all, though maybe I did not perform any write operation.
    – Bruni
    Dec 31, 2019 at 16:35
  • 2
    The error Transport endpoint is not connected means that the process managing the connection has died unexpectedly. The kernel thinks the filesystem is still mounted but there is nothing handling I/O to the target device. Jan 3, 2020 at 14:04

2 Answers 2

2

To force synchronization of a mountpoint you can use the sync command, as for you it could be:

sudo sync /home/bruni/mountpoint

This command will attempt to write all uncommitted data at the moment, similar to the "safe removal" for removable drives.

For davfs in particular, if you have issues, there is a debug flag you can set as you mount the volume which should help with diagnostics.

If there are no errors on your logs or console as you sync the mountpoint and the returncode for it is 0, you can assume it worked.

2
  • Unfortunately sync returns immediately, not waiting for the cache to flush
    – gmk57
    May 11, 2021 at 12:55
  • does not work on centos Dec 26, 2022 at 7:58
0

I registered just to say thanks to Zip!

for me a combination of this: sync /root/mountpoint

and then: umount /root/mountpoint

Caused an output of: /sbin/umount.davfs: waiting while mount.davfs (pid 21) synchronizes the cache .. OK Unmounted

And the files FINALLY appeared for me in NextCloud.

Seriously, thank you!

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .