0

I want to build a family NAS at home. I want to use SnapRAID for integrity. So, it needs to run SnapRaid sync periodically. The sync process requires the data is not being changed while it is running, however. So, I need to make a script that does this:

  1. Check that no files are being written over the NFS shares at the moment.
  2. If they are, wait and repeat
  3. Make NFS read-only
  4. Run sync
  5. Make NFS RW again

The questions are:

  1. How to do #1?
  2. How to do #3 without causing too much alarm on the client side? I can mount -remount,ro the drives themselves, or edit /etc/shares. Or is there another way?

Advise me please...

1 Answer 1

2

Using lsof +d /yournfsshare will tell you if there are any open files on the share at the moment you're running the script. This may change 2 seconds later. I would recommend using the mount -o remount,ro /yournfsshare to set the share read-only and remount again rw when you're done.

You must log in to answer this question.

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