Network Storage Protocols Discussions

Highlighted

Cannot Delete a file located in a CIFS share

We have a file on our NetApp that we cannot delete it says that the file is in use. When we check using computer management it does not list that files as being in use. The file is located on A CIFIS share. How can we get the file unlocked, deleted, or what process has it open?

13 REPLIES 13
Highlighted

Re: Cannot Delete a file located in a CIFS share

Try the command:

netapp> cifs sessions *

(note the '*'). See if it shows a cifs session with your file open.  You could then use cifs terminate <session> to kill off that particular session if necessary.

Hope this helps.

Highlighted

Re: Cannot Delete a file located in a CIFS share

I tried that as well but the files still does not show up as in use.

Highlighted

Re: Cannot Delete a file located in a CIFS share

It's not a folder is it?

Highlighted

Re: Cannot Delete a file located in a CIFS share

No it’s just a file. In fact even trying to bring up the properties of the file take a very long time.

Highlighted

Re: Cannot Delete a file located in a CIFS share

Perhaps it is visible with the lock status command. E.g.:

> lock status -f -p cifs

If found you can break the lock with the lock break command.

Highlighted

Re: Cannot Delete a file located in a CIFS share

I tired to issue this command lock break -f phase4.vsd and it says no locks to break. Even though when I issues the lock ststus command the file shows up in the list.

Highlighted

Re: Cannot Delete a file located in a CIFS share

use a 3rd party tool to force kill the lock?  ofl.exe is what I use in scenarios like that.

Highlighted

Re: Cannot Delete a file located in a CIFS share

You also need to specify the full path name of the file, including volume and qtree. The full path is also listed in the lock status output.

Highlighted

Re: Cannot Delete a file located in a CIFS share

This is the path that it came back with
/vol/ese_admin_share/ES Admin/Projects/PSTools Upgrade/PSTools - Phase4.vsd
So I tried this command
lock break lock break -f /vol/ese_admin_share/ES Admin/Projects/PSTools Upgrade/PSTools - Phase4.vsd
It came back with this error Error:
Invalid option Admin/Projects/PSTools

It seems to be having an issue with the space in the path I tred to inclose it with ' but that did not work.

Highlighted

Re: Cannot Delete a file located in a CIFS share

Thanks for the help we finaly fix this buy using the using the command below.

We were able to fix this by issuing this command.

Lock break -o userid -p cifs

Highlighted

Re: Cannot Delete a file located in a CIFS share

This is a sample on how to initiate the commands


Filer Name> lock break -h 10.50.x.x -p cifs
Filer Name> lock break -h 10.50.x.x -p cifs
Filer Name> lock break -h 10.60.x.x -p cifs
Filer Name> lock break -h 10.50.x.x -p cifs
Filer Name> lock break -h 1060.x.x -p cifs
Filer Name> lock break -h 10.60.x.x -p cifs

Filer Name> lock break -o username -p cifs


Filer Name> lock status -f -p cifs

Highlighted

Re: Cannot Delete a file located in a CIFS share

We ran into the same issue and the lock break command worked like a charm..

We first found the lock by running:

filer02> lock status -p cifs

Drilled down on it and ran this on the host IP:

filer02> lock status -h <ip address>

Broke the lock

filer02>lock break -h <ip address> -p cifs

Verified lock was gone:

filer02> lock status -h <ip address>

Highlighted

Re: Cannot Delete a file located in a CIFS share

Thanks Filer Name> lock break -h X.X.X.X -p cifs worked brilliantly for me.

As a note Even though the locked file had an ip address associated with it, that was the one the client had during the time of the lock being created, since then DHCP had regiven out the IP to another client device. I managed to close the lock on the correct file as well as someone elses connection. May be worth doing these at night to avoid disruption for other users.

Check out the KB!
NetApp Insights To Action
All Community Forums