Operating System - HP-UX
1748036 Members
5050 Online
108757 Solutions
New Discussion юеВ

cannot unlink: Text file busy

 
subodhbagade
Regular Advisor

cannot unlink: Text file busy

Hi,

please suggest for the following issue:------

(1)I am planning to move /etc/opt/resmon/lib/libxerces-c.sl.23 to other dir and create a soft link so that i can make free space in root , but while moving mention file it gives me error

" mv: libxerces-c.sl.23: cannot unlink: Text file busy "

(2) I believe some" unknow file " is already linked to /etc/opt/resmon/lib/libxerces-c.sl.23 due to which it not allowing me to move or Is there are any other reason ?
....how to find the unknow file or source file linked to this file.

Thanks in advance.
Subodh.
10 REPLIES 10
OldSchool
Honored Contributor

Re: cannot unlink: Text file busy

if this ' I believe some" unknow file " is already linked' means you suspect another symbolic link is in place, that shouldn't make a difference....you can delete targets out from under a link all day long w/o complaint. for example:

a -> b, you can delete either w/o an issue.

The file noted is part of an xml parser, and it appears that you have, or a the time had, an application running that needed it, hence the "busy". "fuser" might tell you which app, or better stil "lsof". stop the app, move it and but the symbolic link in place.

James R. Ferguson
Acclaimed Contributor

Re: cannot unlink: Text file busy

Hi Subodh:

You must use 'mv' to rename the old executable to a new name. This _MUST_ be done within the filesystem in which the file resides. Otherwise 'mv' becomes a copy ('cp'). For example:

# mv /etc/opt/lib /etc/optlib.old
# cp /root/newlib /etc/opt/lib

Regards!

...JRF...

Dennis Handly
Acclaimed Contributor

Re: cannot unlink: Text file busy

>(1) I am planning to move /etc/opt/resmon/lib/libxerces-c.sl.23 to other dir and create a soft link so that i can make free space in root

I assume you are moving the whole lib directory? Note if you move it off of root, you won't be able to run that application in single user mode.

>mv: libxerces-c.sl.23: cannot unlink: Text file busy

As OldSchool said, this means some program is using that shlib.

You can move that shlib anywhere else in that filesystem but you can't remove it until that process exits.
What does "bdf /etc/opt/resmon/lib" show?
Dennis Handly
Acclaimed Contributor

Re: cannot unlink: Text file busy

>JRF: You must use 'mv' to rename the old executable to a new name.

The correct command for replacing busy load modules is "ln -f":
# cp .../liba /etc/opt/liba.new
# ln -f /etc/opt/liba /etc/opt/liba.old
# ln -f /etc/opt/liba.new /etc/opt/liba
# rm /etc/opt/liba.new # if you want

This minimizes the window where /etc/opt/liba is missing, which is important if you are replacing dld or libc.

subodhbagade
Regular Advisor

Re: cannot unlink: Text file busy

Hi ,

Thanks for quick reply.

please find the o/p

(1)# bdf /etc/opt/resmon/lib
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 262144 243496 18648 93% /

(2)# fuser -cu libxerces-c.sl.23
libxerces-c.sl.23: fuser: could not find file system mounted at libxerces-c.sl.23.

fuser not giving idea which appln is makingn this file busy...all file are resides in root FS and by moving this i planning to make it free ....

(3)
a -> b now a is linked to b

we can check link by using ls -l of source file of " a " ....but if "a " is unknown then how to check ? in my case i know the path of "b" but donnt know the location of "a" ..or path of a


please suggest ..

Thanks once again...


subodh


Dennis Handly
Acclaimed Contributor

Re: cannot unlink: Text file busy

>(1)# bdf /etc/opt/resmon/lib
/dev/vg00/lvol3 ... /

You can move/ln the shlib anywhere in /, /etc, /etc/opt, ...

>(2)# fuser -cu libxerces-c.sl.23
libxerces-c.sl.23: fuser: could not find file system mounted at libxerces-c.sl.23.

Try an absolute path? lsof would be better.

>resides in root FS and by moving this i planning to make it free

How much space are you talking about? Unless it is 100s of Mb, it may be a waste of time.

>(3) a -> b now a is linked to b
>we can check link by using ll of source file of "a" .... but if "a" is unknown then how to check?

This question won't help because it isn't your issue. The only "link" involved is the normal link of every file in their directory.

What does "ll -i" show for a or b?
If the link count isn't more than 1, there are no extra hardlinks.

To find the hardlink(s):
find filesystem -inum number
Dennis Handly
Acclaimed Contributor

Re: cannot unlink: Text file busy

>(3) a -> b now a is linked to b

This is the ll(1) format for symlinks. Are you asking about them and not hardlinks?
OldSchool
Honored Contributor

Re: cannot unlink: Text file busy

subodhbagade, in original post:

"and create a soft link..." &
"I believe some" unknow file " is already linked"


Based on that, I assumed he meant Symbolic Link, and that's what I attempted to illustrate with:

"a -> b, you can delete either w/o an issue."

However, from your description, that isn't your issue, even though you keep coming back to it, rather the file noted *IS IN USE*

If, however, you are concerned that there is a *Hard* link somewhere, as noted above, you need to list the i-node number of the file, then use "find" as noted above to locate other instances of that i-node.

Note that if there is/are hardlinks in place, then deleting one will delete all. I believe, but can't prove, that fuser will show the file in use based on the i-node.

Read Dennis' post about cp / ln / rm procedure in dealing w/ this.
OldSchool
Honored Contributor

Re: cannot unlink: Text file busy

and the above was directed to Subodhbagade, not Dennis