Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting files not releasing space...

Status
Not open for further replies.
Aug 15, 2002
422
US
Hi folks,

One of my filesystems hit 100%, however was not released after the files were deleted.

Has anyone ever run into this before? Any ideas?

Thanks for any help...

-pd
 
Even though the file(s) were deleted, it's possible that some application still thinks they exist and they are therefore not deleted until the app lets them go. Can you do a fuser <filename> to check whether this is the case. If so (and if possible), kill the session accessing the file(s). HTH.
 
Thanks guys!

fuser -dV was the answer...

Much appreciated!!
-pd
 
The problem is as Ken Cunningham says, a file was deleted and the application writing to the file did not release it because there is still an open file descriptor. You have to restart that application.
 
Exactly...

Thanks... It was my Tivoli Storage Manager web app logs... attached to some VERY old procs that weren't being used. I have another cleanup script to write ;)

Thanks again all!

-pd
 
One thing you could do is write an 'rm' wrapper to avoid these situations in the future. Here is something to get you started:

#!/bin/ksh

OPTIONS=0
PROG='$0'

while getopts rRfie option
do
case ${option} in
r) rOPTION=&quot;-r&quot;
((OPTIONS=OPTIONS+1));;
R) ROPTION=&quot;-R&quot;
((OPTIONS=OPTIONS+1));;
f) fOPTION=&quot;-f&quot;
((OPTIONS=OPTIONS+1));;
i) iOPTION=&quot;-i&quot;
((OPTIONS=OPTIONS+1));;
e) eOPTION=&quot;-e&quot;
((OPTIONS=OPTIONS+1));;
?) echo &quot;Usage: rm [-r] [-R] [-f] [-i] [-e] File...&quot;
exit 2
esac
done

shift ${OPTIONS}

if [ &quot;${fOPTION}&quot; = &quot;&quot; ]
then
PIDLIST=`fuser ${*} 2> /dev/null | tr -d 'a-z'`

for PID in ${PIDLIST}
do
if [ ${PID} -ne ${$} ]
then
echo &quot;Removed failed. ${1} currently in use by:&quot;
echo
ps -fp `echo ${PIDLIST} | tr ' ' ','`
exit 1
fi
done
fi

if [ &quot;${rOPTION}&quot; = &quot;&quot; ]
then
rm ${ROPTION} ${fOPTION} ${iOPTION} ${eOPTION} ${*}
else
for dir in ${*}
do
FILELIST=&quot;`ls -a ${dir}/.[!.]* 2> /dev/null` `ls ${dir}`&quot;
for file in ${FILELIST}
do
if [ -d ${dir}/${file} ]
then
${PROG} -r ${ROPTION} ${fOPTION} ${iOPTION} ${eOPTION} ${dir}/${file}
else
${PROG} ${ROPTION} ${fOPTION} ${iOPTION} ${eOPTION} ${dir}/${file}
fi
done
done
fi
Regards,
Chuck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top