impossible to delete a file from /tmp

pppplus

Verified User
Joined
Dec 19, 2008
Messages
526
Hi

I have some errors, and I can't deleted a "bad" file in /tmp

Listing du répertoire inattendu à la ligne '?--------- ? ? ? ? ? sess_724a7c7be0d5d9e38f4cba86c2bf211e'.
'?' is not a valid integer value

in /var/log/message
Code:
kernel: EXT3-fs error (device loop0): ext3_lookup: deleted inode referenced: 26894
last message repeated 4 times
last message repeated 11 times

so, it seem I have a problem with that file and inode...

How to delete this file ? And maybe kernel error message will disappear.
 
Hello,

The file or inode might be used or opened by a process, that might be a reason. Or login as root unmount /tmp and run fsck for /tmp
 
Last edited:
Hello zEitEr, always quick answer with you, many thanks.

Server is running, what happens if I unmount /tmp ??
 
Nothing special, if you've got many PHP session files there, then opened sessions on sites will be closed, so the users (if any) will need to authenticate again.

Note, to minimize the side affects, you might want to copy/move files from /tmp

Code:
mkdir /tmp-bak
cp -f /tmp/* /tmp-bak
umount /tmp
cp -f /tmp-bak /tmp
fsck -f /tmp

and then

Code:
mv -f /tmp/* /tmp-bak
mount -a 
mv -f /tmp-bak /tmp
 
Thanks, I will do it later, when there are less person connected...
Because I read fsck can take a long time.
 
Hi

My /tmp is about 1Go

I try your command :

1st problem :
Code:
#cp -f /tmp/* /tmp-bak;
-bash: /bin/cp: Liste d'arguments trop longue
I read, this message is displayed, when there are too much file to copy (more than 30000 in /tmp for me)

So I decide to just umount fsck then mount....

2nd problem :
Code:
# umount /tmp
umount: /tmp: périphérique occupé
umount: /tmp: périphérique occupé

And now, I don't know what to do exactly.
Searching google, I read I can do :
Code:
#umount: -l /tmp

But I am not sure, and explanation in man are too hard for me.

Another question, because something is strange for me :
You write to do "umount /tmp"
But after, you write to do "mount -a". Why not "mount /tmp" ?

One more information :
/var/tmpMnt is mounted on /tmp

Thanks for your help
 
I read, this message is displayed, when there are too much file to copy (more than 30000 in /tmp for me)

I guess you need to install and use tmpwatch for CentOS to clean your /tmp periodically (I don't remember the name of such a service for Debian/Ubuntu).

OK, it seems you can not unmount it as device is busy. You should see what processes use it with

Code:
lsof | grep /tmp

and stop/restart them.

Then you'll be able to unmount it.

But after, you write to do "mount -a". Why not "mount /tmp" ?

Both variants are possible if you've got instructions in /etc/fstab for you /tmp partition.
 
Thanks for your help.

But, I need more help ....

1/ I have a file tmpwatch in cron.daily, but not sure it works, because I had very old files in /tmp. I deleted them yesterday.
File is now
Code:
#!/bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
	-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
	-X '/tmp/hsperfdata_*' 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
	/usr/sbin/tmpwatch "$flags" -f 720 "$d"
    fi
done

2/ lsof
Code:
# lsof | grep /tmp
bash       1431       root  cwd       DIR                7,0     8409088          2 /tmp
httpd      2341     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2342     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2343     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2344     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2345     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2346     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
httpd      2347     apache 1111u      REG                7,0           0        118 /tmp/ZCUDPEHEBH (deleted)
And a lot of line httpd continue to be added.

And now, I don't know what to do... Sorry to ask you a new time.
 
That's OK , don't worry about my time I spend here.

1/ I have a file tmpwatch in cron.daily, but not sure it works, because I had very old files in /tmp. I deleted them yesterday.
File is now

I usually set 24 hours, so it would look like this:

Code:
#!/bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
	-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
	-X '/tmp/hsperfdata_*' 24 /tmp
/usr/sbin/tmpwatch "$flags" 24 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
	/usr/sbin/tmpwatch "$flags" -f 24 "$d"
    fi
done



So it seems you are using mod_php, so try to stop apache and unmount /tmp, after that you might want to start apache or wait for cron that will start apache by directadmin check.

Note, before mounting /tmp back, you might need to stop apache again.
 
Hi zEitEr

I use mod_ruid2.
This morning, I check logs, and I have no more problem, whitout doing anything... so it's perfect.
Thanks for your help.
 
Back
Top