0

On Debian Squeeze, when nginx is running, it puts a handle on my development files (css, html) and I am unable to delete them unless I stop nginx. This is a problem because it's my development environment (I wouldn't care if it was production), is there any setting I can switch so it doesn't put a lock on all my files?

4
  • That doesn't sound like normal Linux behavior. Do you have some command output? Dec 5, 2012 at 23:53
  • When I try to delete it, it says "text file is busy". Here's the lsof output: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 1534 www-data 12r REG 0,18 32401 8 style.css
    – Ayub
    Dec 5, 2012 at 23:56
  • Exactly how are you trying to (1) delete the files, and (2) replace them? And what type of filesystem is storing these files? Dec 6, 2012 at 0:00
  • Solved this by turning open_file_cache off Got the answer from here serverfault.com/questions/450991/…
    – Ayub
    Dec 6, 2012 at 0:07

1 Answer 1

0

Best guess is:

Your files aren't actually on a UNIX or Linux filesystem, but on a Windows-based filesystem, either mounted locally (NTFS) or remotely via SMB/CIFS. These filesystems don't permit one process to remove a file being used by another process.

On a normal UNIX or Linux filesystem, you could replace the file with no issues, and the process that had the file open would still use the old file until it closed it, at which point it would be permanently deleted.

The solution here is to move your files off the NTFS or CIFS share and onto a native filesystem.

3
  • Thanks for the guess, but the problem was that I had a setting in nginx that locks files, I turned that off on development environments, and it is working normally now.
    – Ayub
    Dec 6, 2012 at 0:09
  • 1
    Well, it's not a bug, just the way Windows filesystems work. Dec 6, 2012 at 0:12
  • 1
    @Ayub Indeed, mentioning that you were serving files from a network filesystem on another OS would have been very helpful. Dec 6, 2012 at 1:11

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.