0

I'm working on a backup system over NFS, and I want to ensure as much as I can that the files are really written to the disk. Currently, when doing backups on my local hard disk, I copy everything into a temporary folder, do a sync() to flush the caches, rename the temporary folder to the final name, and do another sync(). That way, if system hangs during backup, or there's a power failure, the half-made backup will be in an easily-identified folder and can be deleted and started again when the system boots again.

Is it possible to do this over NFS? Do a "remote sync()" call to ensure that the server has flushed the cache to disk?

Thanks.

2 Answers2

1

When you mount your drive over NFS you can tell it to sync by adding 'sync' as one of the options. I believe by default it does this. Therefore there is no need to worry about doing a sync call as it is already happening for you. When the server responds saying the data has been written to disk you can assure that is has.

If you are using a *nix system (including Mac) you can use rysnc which is a very handy tool for backups if you have a lot of data.

Travis
  • 36
  • 2
0

Consider just

sudo mount /nfs-mount -o remount

The -o without any other options is fine.

This helped me, when I had a file on /nfs-mount, that, when remotely updated, was not locally updating. Mount option sync did not help, and might have had performance penalties also.

Janne
  • 91
  • 1
  • 5