LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   6 gig /tmp folder !!!! (http://www.linuxquestions.org/questions/slackware-14/6-gig-tmp-folder-505984/)

slzckboy 11-29-2006 02:20 PM

6 gig /tmp folder !!!!
 
My /tmp folder is a tad on the large side.
I'm fighting the rm /tmp/* urge.

Is there no easy way to know what is vital/useful information and what is guff?
As always thnks in advance.

nonfatalexec 11-29-2006 02:28 PM

There's a program called tmpwatch which recursively removes old files from /tmp.

Hope this helps.

slzckboy 11-29-2006 02:32 PM

I hope so too.
/ is at 99% and I could use the space :0)
Many thanks.

slzckboy 11-29-2006 02:49 PM

went for stmpclean in the end,it does the same sort of thing.Thnks again.

tuxdev 11-29-2006 03:33 PM

Um, you can just mount /tmp using tmpfs. Then tmp will be wiped out when you reboot.

Also, rm -r /tmp/* is supposed to be safe. The files won't really go away until every program with a file handle dies.

MS3FGX 11-29-2006 03:36 PM

Removing everything in /tmp should be fine. I have done that occasionally when it was getting a little crazy in there, and never had a problem. If it was important, it wouldn't get dumped into a temporary directory.

slzckboy 11-29-2006 04:13 PM

thnks,i have " taken the plunge and did rm -r /tmp/*.
All seems well.

:)

raska 11-29-2006 04:26 PM

Quote:

Originally Posted by tuxdev
Um, you can just mount /tmp using tmpfs. Then tmp will be wiped out when you reboot...

mmmmh I liked that one, is a neat idea.

How much space should I give to /tmp ?
I know that mounting with tmpfs gives by default half of the RAM to the filesystem but I have 2 gigs of RAM, I don't want to spend 1 gigabyte in /tmp

tuxdev 11-29-2006 05:02 PM

The 1G is max usage, not what it is currently using. You only pay for what you actually use, and the cap is there so that tmpfs doesn't bring the system to its knees. If you want, you can pass size=512M or somesuch in. There's an article in the LQ wiki (that I helped write) if you are interested.

I actually use it as an compost bin of sorts. I made a function so that "rm" would copy the data to /tmp and remove the original.

slzckboy 11-29-2006 05:20 PM

/du -m /tmp gave an output showing 7001 Meg used.

df -m showed /dev/hdb1 mounted on / at 100%

startx was failing because i guess x had no where to place the necessary files at startup!?!??

after I dumped the contents of /tmp, / is now at 59 % and now X will start.

If one gig is the max limit how come I had 7 gig in my tmp folder?
Sorry but confused.
??????

raska 11-29-2006 06:01 PM

Quote:

Originally Posted by tuxdev
The 1G is max usage, not what it is currently using. You only pay for what you actually use, and the cap is there so that tmpfs doesn't bring the system to its knees. If you want, you can pass size=512M or somesuch in. There's an article in the LQ wiki (that I helped write) if you are interested....

That's good to know, thanks tuxdev, I'm going to review this intel once I get back at home and start tweaking this stuff ^_^


Quote:

Originally Posted by slzckboy
...If one gig is the max limit how come I had 7 gig in my tmp folder?
Sorry but confused.
??????

That was because you had your /tmp folder resident in your / partition, physically in your hard disk, without a space limit. tuxdev was talking about using tmpfs for the /tmp folder, which is a neat kernel trick that gives you a temporal/virtual filesystem resident in the computer's RAM.

tuxdev 11-29-2006 08:00 PM

You're Welcome ;). raska, here is the function for .bashrc I wrote to do a simple compost heap:
Code:

function rm {
  /usr/bin/cp -f "$@" /tmp 2> /dev/null
  /usr/bin/rm "$@"
}

Real simple, ne? I know it can overfill /tmp, but that's something I just deal with on a case-by-case basis.

On an unrelated note, I have no clue why that is K&R, I code using BSD most of the time.


All times are GMT -5. The time now is 11:22 PM.