Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I've got a Samba share located on server A. I have that share mounted to two other servers, B and C. The idea is that B and C need to write temporary files to a single location so that multiple background processing jobs (also running on B and C) have access to the same pool of files.

When the background processes are complete they delete the file they were working on. When I do a directory listing of the share after a file has been deleted the original files names are now along the lines of cifs79, cifs78 etc. They take up the same amount of space as the original file so I assume they are the originals, just renamed.

The problem is these files don't go away unless I restart samba (which I don't plan on ever doing). Am I missing a simple config param that will delete files immediately?

I created my shares with this command:

mount -t cifs //10.251.251.251/uploads ./uploads -o username=samba_user,noexec

The files go into the share as -rw------- and remain that way after they change names.

Now, if I manually create a file from the box that has the share mounted, I can create, edit, delete no problem. If I start an IRB (interactive ruby) session, I can use Ruby to create/delete files no problem. It seems to be the app itself (Rails 2.3.3) which creates the file with strange permissions. But, the app and my IRB session are running as the same user, so they should have the same permissions to do whatever, no?

When I create a file on the command line or from IRB the permissions are set -rw-rw-rw-

Here's the full smb.conf file and the output of smbstatus at the bottom: http://gist.github.com/172474

Thanks for any help!

share|improve this question

1 Answer 1

There is, probably, a sharing/locking problem on your files. The background process is temparing the files while they are still written to by whoever is creating them.

remove the:

locking = no

from your smb.conf file. It should solve the problem. This parameter should be used only on read only shares. Like cd. Make sure that all acess to those files is through samba share. If you access them directly from the os or from nfs share. Then read this carefully.

share|improve this answer
    
Hi, I removed that command but it didn't appear to make any difference (files were still being replaced with the cifs name). I logged into that box today (it's been about 20 hours since I made the change) and those temp renamed files are gone. <shrug> Maybe there's some background process that goes in and cleans them up? –  Anonymous Aug 25 '09 at 16:16

Your Answer

 
discard

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