LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to clean /tmp (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-clean-tmp-533046/)

mkhan919 02-27-2007 04:00 PM

How to clean /tmp
 
Hi,
I am using mandriva 2007. I was just playing around with converting some video file and it seems that a lot of stuff was put into /tmp. Now when i try to login to KDE i get an error that /tmp is out of disk space and i cannot login. I have currently logged in using ICEWM but want to know how to get rid of stuff in /tmp. I read some place that i should not simply delete the stuff in /tmp since it may cause my system to crash..

*******************
Update...

well i went ahead and deleted everything up from /tmp. Everything is back to normal now.
Any ideas how i can set the system to clean /tmp everytime before shutdown or restart

Any ideas please..

MS3FGX 02-27-2007 04:12 PM

I have always just deleted all of the files in /tmp every few months and never had a problem. But I suppose some distributions/programs might actually have a problem with that.

The safest thing would be to just figure out what files were created in /tmp when you were editing the videos, and delete just those. It should be easy enough to tell based on the time the files were created and their size (logically they are going to be pretty large).

alienDog 02-27-2007 04:15 PM

This will do the job perfectly:

find /tmp -type f -atime +3 -exec rm {} \;

It finds the files that were accessed 3 or more days ago and removes them. You can also have cron do it for you automatically. In general it _should_ also be safe to clear the /tmp on boot.

Electro 02-27-2007 05:51 PM

If the computer has a lot of RAM (1 GB or more), /tmp can be bind to /dev/shm. The directory /tmp will never get full because it gets erased every time the computer reboots and unmounts /tmp. Linux will improve in performance if you do bind /tmp to /dev/shm. The permission that needs to be used is 1777 while binding the /tmp directory.

Some distributions may have the tmpwatch script in their database, so do a search.

Hitboxx 02-27-2007 08:34 PM

Quote:

f the computer has a lot of RAM (1 GB or more), /tmp can be bind to /dev/shm. The directory /tmp will never get full because it gets erased every time the computer reboots and unmounts /tmp. Linux will improve in performance if you do bind /tmp to /dev/shm. The permission that needs to be used is 1777 while binding the /tmp directory.
Electro this is interesting, how do i bind it?

Electro 02-28-2007 12:49 AM

In /etc/fstab, use the following lines.
shm /dev/shm tmpfs mode=1777,nr_inodes=1M,size=X 0 0
/tmp /dev/shm none bind 0 0

The maximum size I suggest for the size of X is 75% of your total RAM. This will still give you enough space when your /tmp fulls up during use. Also movies that mplayerplug-in downloads will be a lot faster when playing back the videos even when SDRAM memory used. Since the permission for /tmp can be use by anybody, you will have to secure your setup to the users that you trust. You may want to use AIDE or tripwire to keep an eye on /tmp.

I only recommend this setup if you are using ECC memory. There is a higher possibility of data corruption when not using ECC memory.

The following link that I found a few years ago but still is good.
http://www-128.ibm.com/developerwork...ary/l-fs3.html

mkhan919 03-05-2007 01:19 PM

Thanks a lot. That really helped.....:cool:

Hitboxx 03-05-2007 01:34 PM

Thanks Electro.


All times are GMT -5. The time now is 10:52 PM.