-   Linux - Software (
-   -   Samba on NFS File Locking (

Cottsay 08-21-2006 03:29 PM

Samba on NFS File Locking
For a long time I've mounted Samba shares (on my Samba PDC) on an NFS share located on a storage system. (so theres a folder on my NAS server which is mounted via NFS on my PDC which is mounted via Samba on the Windows computer beloning to the domain). Recently, I started getting this message while trying to write a file that is mounted in such a mannor:

The process cannot access the file because another process has locked a portion of the file.

This only happens on the NFS/Samba shares. It works fine if the folder on the PDC isn't mounted via NFS. I can copy files to the NFS folders just fine from the PDC's command shell. It worked update maybe? Any help is appreciated.


Scott K Logan

ramram29 08-21-2006 03:53 PM

NFS is known for having locking problems. That is why it is never used for shared directories. Usually you would mount an NFS directory read only or as a home folder where only one user can open and lock each file.

I recommend dropping NFS and using only Samba shares. Samba handles file locking very well and it also has user authentication whereas NFS handles only host based authentication. Plus Windows utilities for NFS are very rare and poor in design.

Samba is called The NFS Bloodbath. NFS has litteraly been fazed out by Samba. Another very promissing file sharing method is sshfs which is user based and with high encryption (excellent sharing directories over WAN connections).

Cottsay 08-21-2006 11:47 PM

alright...well I need NFS because it maintains rights between systems...can sshfs do that? I know samba doesn't work that way...

ramram29 08-22-2006 08:34 AM

Samba does maintain file permissions as far as I can remember. You can also change the umask of each shared folder so that only the user that created the file has rights to it or so that the entire group has rights. You should really try Samba and drop NFS, especially if you are sharing the remote folder. sshfs should also work with permissions and you can even use it securely over the Internet. Though it only works on the kernels Linux 2.4, 2.6 and FreeBSD.

tha.siegrist 01-26-2012 06:15 AM

Samba works on NFS-Shares if you switch off strict locking in smb.conf


strict locking = no

Robert.TreBor 07-28-2015 02:23 AM

Switching off strict locking in samba did not help us with the issue in that it solved the consecutive lock issue, but generated another of files not being updated.
What helped us was changing the way we mounted the NFS share by adding "nolock" to the NFS mount options. Thought this might be useful to someone.


All times are GMT -5. The time now is 02:44 PM.