Is there a way to identify files that are actively being written to a CIFS mount in Linux? I am interested in skipping those files.

My first thought would be to fine tune the find command with mmin. I am not sure if this would catch them though.

find /cifs -type f -name "*.wav" -mmin +3

I would take a look at the smbstatus command.

There you could grep for READ/WRITE locks (e.g.)

smbstatus  | grep RDWR

Add sed or awk magick to get to the file name.

  • So I should clarify that a different server is writing these files to the share – kernelpanic Feb 4 '16 at 19:06
  • you could still use smbstatus over ssh, (from the writing server): ssh <server with smb share> smbstatus | grep RDWR Of course you need to set up authentication by ssh key pair. – remote mind Feb 4 '16 at 19:12
  • I don't have access to the servers writing to the share – kernelpanic Feb 4 '16 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.