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

So via what I suspect is a cron'd rsync gone awry, I noticed that I have ~25000 variants of .DS_Store in a directory that's on an external disk, they're named "..DS_Store.FOO" where FOO varies. The problem is that I can't seem to delete them, even using the various tricks I've seen over the years for removing files with oddball names. No problem, I said - I moved all of the real files into another directory and then just tried to do an 'rm -r' on the original directory ... no luck, it fails to delete those files and says directory not empty. Tried it again with 'rm -rf' and still no luck.

I have no idea how to get rid of this thing, does anyone have any idea?

Edit: Ok, sorry all but I was a bit of a bozo here. I had ssh'd into the network but was not actually on the machine that had the drive physically connected to it, but rather mounted over the network. I was able to do an 'rm -r' from the actual host machine. Unfortunately, I didn't actually think it would work so I didn't go through the other less serious steps first (manipulating an individual file, etc) so I still don't know if this was a sign of weirdness on the disk or just something due to the network mounting.

share|improve this question
    
What does it say when you try? Does it just silently fail? or do the files get instantly re-created? Can you delete a single one manually? (not useful for 25000 files, but good for diagnosis) –  Brian Postow Apr 12 '10 at 14:44
    
Can't delete manually via any mechanism that I've tried. It always says that there's no such file (except for the 'rm -r' cases where it silently fails and says the directory isn't empty at the end). This is also the case if I simply try to cp/mv one of these files. –  geoffjentry Apr 12 '10 at 14:53
1  
If you do lsof /path/to/file_name does it show that the file(s) are being held open by some process? –  Dennis Williamson Apr 12 '10 at 15:10
    
What are the permissions and owner/group of these files? Show us an ls -lab. –  Dennis Williamson Apr 12 '10 at 15:34
    
It might be a good idea to post your solution as your own answer and mark your question answered. –  Zsub Apr 12 '10 at 19:32
add comment

1 Answer

Get all the files off the external disk and reformat it.

Edit after comment: I do not know what the output of the commands was, so you would have to post that to give us more info. Without that information, the only way I can be quite sure those files will be gone is to 'nuke them from orbit' as you eloquently put it.

Have you tried chown/chmodding them, by the way? Of course, all as root.

share|improve this answer
    
Interesting. Is this an indication of an issue w/ the disk, or are you saying that as nuking the files from orbit is the only way to be sure? –  geoffjentry Apr 12 '10 at 14:39
    
It entirely depended on whether you could find a process holding the files open, permission on those files, etc...reformatting the drive is a rather drastic step without first checking if it was something as simple as a stuck file handle or a goofed permission, and without knowing the error messages from trying those methods first, it would be hard to say. But formatting the drive would most likely solve the undeleted file issue...if not, it may highlight if there's a drive problem. –  Bart Silverstrim Apr 12 '10 at 17:02
add comment

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.