Pesky File that won't delete.

I am frustrated.

I have a file on a moodle server that won't delete. This is running on FreeBSD 8.0-p3. I have tried rm -rf *, I have tried to rmdir -pv dir/, I have tried ls -il, then find . -inum [inode-number] -exec rm -i {} \;

I have chmod 777 the file and chown root:wheel the file and it still will not delete.

The folder it is in, resides on an nfs share (emc celerra), and the only thing I can think of is that I only have rw access to this share instead of root.

Any Thoughts?
 
If you are positive file is not locked by any process, maybe flags are set on it.
Try
# ls -lTdo file
Code:
foxi:(/tmp)# ls -lTdo file
-rw-r--r--  1 root  wheel  [color="Red"]schg [/color]0 Jan 25 14:31:16 2011 file
foxi:(/tmp)#
also check chflags(1).

UPDATE: d'oh- it is just now I see that you said it is on NFS - ignore my post then (why don't you check EMC settings then?)
 
I forgot to add that I changed the file name as well currently it is 12345

when I did # ls -lTdo 12345 I got

Code:
-rwxrwxrwx  1 root  wheel  - 127251622 Jan 24 10:38:51 2011 12345

I did a ls -io to list flags and I got

Code:
278297 12345

I finally got to check the emc celerra and this server is set for root access to this nfs slice.

I am open to any suggestions short of nuking the server..

thanks
 
I tried getfacl 12345

Code:
# file: 12345
# owner: root
# group: wheel
user:: rwx
group:: rwx
other:: rwx

Everything looks right, that's why I am pulling my hair out....
 
I changed the file name after I discovered that it wouldnt delete.

this is a file that is in /moodledata/temp/backup.

There is a known issue with moodle failing to backup its courses and the fix is to fix the references in the mysql db and to delete the /backup directory.

The best I could manage was to rename the directory to backup2 and then my moodle problem was fixed. Now I am stuck with a file in a folder that I can't delete.
 
Mhm .. I'd say you did rename it when it was used by moodle, at least it seems that way to me.
Can you restart the whole moodle (I'm not familiar with it, so not sure what all dependencies it takes with it to do a proper restart)?

Did you try to use lsof on it as @tingo suggested ? It is not part of the base system, you have to install it.
 
Why not use the base system's excellent fstat(1) instead of going on about lsof .. ;)
(Ok, it's only been present since 4.3BSD-Tahoe, so it's new-ish)
 
As suggested by the great and mighty DD, I tried fstat using the following command:

fstat -f /nfs/www/moodledata/temp/backup2/1294221889/

which returned:

Code:
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
root     fstat      44512   wd /nfs     214783 drwxrwxrwx    7168  r
root     bash       44453   wd /nfs     214783 drwxrwxrwx    7168  r
www      httpd      67116   wd /nfs     206019 drwxr-xr-x    3072  r
www      httpd      67116   15 /nfs     278297 -rwxrwxrwx  127251622  w

I saw that I had a httpd process that seemed a bit odd. so I checked top and found this.

Code:
last pid: 44528;  load averages:  1.14,  1.17,  1.10 up 49+01:24:29  08:02:58
55 processes:  3 running, 52 sleeping
CPU: 58.3% user,  0.0% nice,  3.8% system,  3.6% interrupt, 34.4% idle
Mem: 2372M Active, 706M Inact, 161M Wired, 112M Cache, 102M Buf, 396M Free
Swap: 4096M Total, 124K Used, 4096M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
67116 www         1 118    0 70904K 50204K CPU3    3 447.2H 98.68% httpd

OMG!

I restarted apache, and lo and behold I was able to delete the file.

Thank you all for you assistance. I appreciate it!
 
Back
Top