Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My organisation uses Debian Linux running Samba for office file servers. Users run Outlook for their email, which crashes fairly regularly and leaves the outlook.pst file locked.

Currently, our procedure for removing the lock (which allows the user to use Outlook again) is:

  1. Manually open a terminal session
  2. Go to the users dir holding the outlook.pst file
  3. Remove the ~outlook.pst.tmp file (or similar name)
  4. Rename the pst file (eg mv outlook.pst outlook.pstoff)
  5. Copy the file back to outlook.pst (ie cp outlook.pstoff outlook.pst)
  6. Remove the old file (ie rm outlook.pstoff)
  7. chown outlook.pst to the user

This could be scripted reasonably easier, but to be done properly it would need checking for available disk space before doing the copy. Is there some easier way to remove the lock on the file without copying it?

share|improve this question
    
Maybe it would be better to solve problem with Outlook? –  pbm Mar 20 '12 at 22:14
    
Outlook just gives an error when the user tries to reopen it after this has happened. I think the lock disappears after about 15mins or so, but that's too long for a lot of users. –  Highly Irregular Mar 20 '12 at 22:19
    
(Or did you mean solve it by using something else? Believe me, I would be doing that if I had the choice!) –  Highly Irregular Mar 20 '12 at 22:26
    
Check why Outlook is crashing. If it crash regularly it means that there is a reson - maybe there are some information in Event logs, maybe it crashes on some operation on Samba share. Try running smbd in debug mode - maybe you can find some regularities. Also check for error code in MS KB... –  pbm Mar 20 '12 at 22:37
    
One additional reason we get a large number of locked pst's (all at once) is when there's a brief network or file system outage and users' pcs can no longer connect to the server. In this case, Outlook closes semi-gracefully, but still won't reopen until the lock is cleared. In other cases, (maybe once every 2nd day amongst 80 staff) Outlook just crashes. Trying to catch this with Samba in debug mode might be a stretch. I can't recall any error code being given in either case, but I'll try to remember to look for it next time I see it happen. Thanks for the suggestions –  Highly Irregular Mar 20 '12 at 22:53

1 Answer 1

up vote 2 down vote accepted

This LINK to the lists.samba archive has a user with the same file locking issue.

Essentially find the PID of the process and kill the process this should free the lock (sometimes) I have used this in the past and it has worked for me any time that I had a locked file. But, I am not using outlook. The next response in the thread has a [global] option setting for samba being suggested.

You might try to set reset on zero vc = yes in your [global] section.

EDIT: This is pretty good reading on samba locking. Chapter 17. File and Record Locking

share|improve this answer
    
This question has a similar suggestion: serverfault.com/q/204812/83424 I'm not sure what the implications might be of such a change though. –  Highly Irregular Mar 22 '12 at 3:08
    
@HighlyIrregular - It means that if the Samba server sees each connecting client as a separate IP it will kill the prior connections. But, should they be coming from another network that has its own router and the connecting clients are all seen coming from the routers IP it would be a bad move to implement. The gist is that the files are locked and this will (when the same client connects) it will kill it's previous connections freeing up the locked file. –  2bc Mar 22 '12 at 10:50
    
@HighlyIrregular - How I typically test such changes are to make a modification to my smb.conf file that allows me to include separate smb.conf files for different shares. include = /etc/samba/SHAREiCANBREAK/smb.diff.conf - This goes in your global definition. Then you create a new smb.conf defining a share that is independent of your production. Use that for the new share definition and options. This is assuming that you don't have a Test / QA samba server that you duplicated your production on. –  2bc Mar 22 '12 at 10:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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