Link to home
Start Free TrialLog in
Avatar of wfaleiro
wfaleiroFlag for India

asked on

Freeing temp space

Hi,
On my solaris machine the /tmp folder appears cluttered. To free up the space, can I delete the files and folders or should I followup a procedure to check if the files are being still in use.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of macker-
macker-

From a programming standpoint, /tmp should be considered unreliable, and the contents could disappear at any time.  Unfortunately, this is not always respected, and potentially in-use files may be there.  Noteable examples include screen sessions and MySQL's socket.

The find command referenced by Tintin is an excellent one for this purpose, as it will only delete files that were last modified no less than a week ago.  You may also wish to remove files based on name.  E.g. PHP has a habit of leaving session files laying around, and some user programs (especially KDE based) will often leave stale files that don't get deleted.  This may happen because of unexpected exits, sloppy programming, or any other number of reasons.

Also, if the server is rebooted, the files in /tmp are safe to delete (before programs are restarted).  If you want to check if any files are actively open and in-use by a program, check with lsof.  Note, though, that a program may still want to access a file but not have an active file handle open for it.
macker: If the server is rebooted then /tmp is deleted, as /tmp is (by default) a ramdisk.

I basically agree with tintin's solution, even though, for a very small chance there could be files not being modified for a week and still being needed.

I personally "solved" this by rebooting the server when I apply the latest patchcluster (and by the reboot as said, the ramdisk is of course cleared). I know that this might not allways be possible, but if possible I think it's quite a good solution.
Ah, had not recalled that it's a ramdisk.  That certainly tidys things up.  In any regard, it sounds like Tintin's solution is the best by consensus.