LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-27-2007, 05:00 PM   #1
mkhan919
Member
 
Registered: Jan 2007
Location: Valbonne, France
Distribution: Mandriva 2008 (Free)
Posts: 135

Rep: Reputation: 15
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..

Last edited by mkhan919; 02-27-2007 at 05:06 PM.
 
Old 02-27-2007, 05:12 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
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).
 
Old 02-27-2007, 05:15 PM   #3
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 46
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.

Last edited by alienDog; 02-27-2007 at 05:16 PM.
 
Old 02-27-2007, 06:51 PM   #4
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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.
 
Old 02-27-2007, 09:34 PM   #5
Hitboxx
Senior Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,562
Blog Entries: 3

Rep: Reputation: 51
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?
 
Old 02-28-2007, 01:49 AM   #6
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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
 
Old 03-05-2007, 02:19 PM   #7
mkhan919
Member
 
Registered: Jan 2007
Location: Valbonne, France
Distribution: Mandriva 2008 (Free)
Posts: 135

Original Poster
Rep: Reputation: 15
Thanks a lot. That really helped.....
 
Old 03-05-2007, 02:34 PM   #8
Hitboxx
Senior Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,562
Blog Entries: 3

Rep: Reputation: 51
Thanks Electro.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kde, /tmp, /var/tmp and all that garba Linux - Software 4 06-17-2005 01:31 PM
Create file using 'touch ./tmp.$$', file tmp.3941 is created, why? huangyanfeng Linux - General 1 04-13-2004 04:36 AM
"/tmp/sv001.tmp/setup.bin" error while installing OO1.1.0 Choey Linux - Software 0 09-16-2003 05:52 PM
Numerous scb_*.tmp files in /tmp dburk Programming 3 08-18-2003 05:28 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 02:03 PM


All times are GMT -5. The time now is 04:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration