1

I have somehow generated a file on a network mounted volume that is in the busy state, and I have no knowledge of what could be using it. I want the file gone, and am not really concerned about whatever might be trying to use the file. I will document the process by which I created the file below.

Also, I know that there was a similar question asked before Here, but none of them have worked for me, and I can't comment on them with my current reputation to ask for clarification.

$echo "day" > other_tmp
$cat other_tmp
day
$sed "s/day/night/" <other_tmp>other_tmp
$vi other_tmp

It is empty, so I try to re-populate it to try again.

[i]
day
[esc]
[:wq!]

Something goes wrong, I get the following back

"other_tmp" 1L, 4C written
E207: Can't delete backup file
Press ENTER or type command to continue

The q! makes me skip this though.

$ls
other_tmp      other_tmp~
$rm other_tmp
$rm other_tmp~
rm: other_tmp~: Resource busy
$rm -f other_tmp~
rm: other_tmp~: Resource busy

That's where I got to when I started looking for help.

Most of the answers I've found suggest using lsof filename

$lsof other_tmp~
$

Nothing.

Others suggested renaming the file and then using finder to kill it. $mv other_tmp~ new_name $ls new_name It moved to a new name successfully. But finder gave me the following error when doing Move to Trash.

The operation can’t be completed because the item “new_name_2” is in use.    

And this is where I am now. Except I ran through the process again to see if it was reproducible so now I have new_name and new_name_2.

I can't restart the volume, because I don't have those permissions. I just want to delete the files. Its not a terrible high priority given that their filesize is 0, but they are are enough of a nuisance that I have gone this far to try to remove them.

====UPDATE====

$fuser new_name
new_name:
$
  • Look for fuser or lsof (or the equivalent in OSX) that could tell you what process keeps the file open and kill that process if possible. – Gombai Sándor Apr 21 '16 at 15:26
  • lsof returns nothing. fuser returns new_user: and nothing else. – Gadget Apr 21 '16 at 15:29
  • Then my only reasonable hint is out. I can give you an improbable one as well (with half an hour of experience on Mac): if the file status is cached and bound you id, a windows-like logoff/logon may help. – Gombai Sándor Apr 21 '16 at 15:38
  • Thank you for trying to help. Someone (not here) recommended restarting the machine I was on with the off chance that even though no process could be found it was hiding somewhere. I did that and it worked. I hadn't done that earlier because I don't have a good way to get all my windows back open and in the correct places. – Gadget Apr 21 '16 at 16:00
  • 1
    Okay, figured it out. I was running a unix file system through a cifs mount to another unix file system and something was going wrong in there. It worked when I switch to using NFS. I didn't realize I had an option on that one. – Gadget Apr 22 '16 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.