Network and Storage Protocols

Cannot Delete a file located in a CIFS share

curtissw531
26,890 Views

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

adamfox
26,848 Views

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.

curtissw531
26,848 Views

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

adamfox
26,848 Views

It's not a folder is it?

curtissw531
26,848 Views

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

pascalduk
26,848 Views

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.

curtissw531
26,848 Views

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.

pascalduk
26,848 Views

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.

curtissw531
26,850 Views

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.

curtissw531
15,120 Views

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

arram715
26,848 Views

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

seftekhari
15,118 Views

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

garciam99
15,118 Views

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>

stuart_tormey
15,118 Views

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.

Public