Can you safely delete all files in /tmp? -- Jaco Carlson Welcomp Computers Mpumalanga -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon November 12 2007 23:04, Jaco Carlson wrote:
Can you safely delete all files in /tmp?
I would say, it depends. Some files and directories are used for your current environment, such as kde-username/ and ksocket-username/ and some .tmp files. Have a look at which are the recent files with "ls -lrt" (newest files at the end). But it would be safe to delete them all just before you reboot or halt your machine. -- Carlos FL Who is General Failure, and why is he reading my disk? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Carlos F Lange wrote:
On Mon November 12 2007 23:04, Jaco Carlson wrote:
Can you safely delete all files in /tmp? But it would be safe to delete them all just before you reboot or halt your machine.
in /etc/sysconfig/cron , there's a line which looks like this: CLEAR_TMP_DIRS_AT_BOOTUP="no" Setting that to "yes" will do the trick. Assuming one isn't an uptime jockey :) JA - -- http://www.DonAssad.com jabber ID: josef.assad@gmail.com Please consider the environment; do you really need to print out this e-mail? -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFHOW4hFcf72sjD2+QRAnZgAJ9nRFf3I7k7Qb3DJkaorlZaJtwcxQCdHJrB UKX9qOW1xNDTNUBGQuS10vk= =1rRq -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos F Lange wrote:
On Mon November 12 2007 23:04, Jaco Carlson wrote:
Can you safely delete all files in /tmp?
I would say, it depends. Some files and directories are used for your current environment, such as kde-username/ and ksocket-username/ and some .tmp files. Have a look at which are the recent files with "ls -lrt" (newest files at the end). But it would be safe to delete them all just before you reboot or halt your machine.
It's possible to configure the system, so that /tmp is cleared on reboot. -- Use OpenOffice.org http://www.openoffice.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
mostly. Open files won't be deleted. Of course on a multi-users machines this could be tricky jdd -- http://www.dodin.net http://www.ladepeche.fr/article/2007/10/27/127022-Claire-Dodin-une-Toulousai... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
Only if they're not in use. You can configure the system to periodically clean out the files of a certain age. -- Use OpenOffice.org http://www.openoffice.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
James Knott wrote:
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
Only if they're not in use. You can configure the system to periodically clean out the files of a certain age.
openned files can't be deleted, even by root. So a su cd /tmp && rm -R * should be safe (I do this regularly). However it is possible that an application close a temp file and try to open it again (in my opinion a poor idea). If you are the only user of that PC, close all your apps before and go, on muliuser one, I wouldn't do that jdd -- http://www.dodin.net http://www.ladepeche.fr/article/2007/10/27/127022-Claire-Dodin-une-Toulousai... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Quoting Jaco Carlson
Can you safely delete all files in /tmp?
Many will be in use. It is not a good idea to delete them. It is safe to delete those from before the last reboot. Reboot, not resume from suspend/hibernate. HTH, Jeffrey -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Jeffrey L. Taylor wrote:
Quoting Jaco Carlson
: Can you safely delete all files in /tmp?
Many will be in use. It is not a good idea to delete them. It is safe to delete those from before the last reboot. Reboot, not resume from suspend/hibernate.
A files which is in use will not be re-allocated until after the process which is using it does a close() on the file handle. Unless a program is written very stupidly (close a tmp file, and then attempts to re-open it), removing files in /tmp should be entirely safe. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2007-11-13 at 07:52 -0600, Jeffrey L. Taylor wrote:
Quoting Jaco Carlson
: Can you safely delete all files in /tmp?
afair, on sun-os they reformat /tmp during boot, while still in single user-mode: much faster than deleting files (if there are lot of them) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
Yes. Any files which are still in use will be in an OPEN status. The process which has the file open will have a handle to the file, and accesses the file through the handle (not the pathname). When you remove files, what actually happens is that the file is unlinked from the directory it is in (its directory entry is removed)....however, since it still has an open reference, its disk blocks will not be re-allocated until all processes which have an open file handle close their handles to the file. This functionality is actually used by some programmers -- they will open() a new file in /tmp (which creates a pathname /tmp/somefilename), then they remove the file (while still having the open file handle). This effectively hides the file from practically everything on the system -- it's a way of preventing a tmp file from accidentally being corrupted by ANY other processs (other than a super-user process writing out in kernal memory). All other files, which do NOT currently have an open file handle will be removed and re-allocated to the free list just as you would expect. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2007-11-13 at 21:38 -0500, Aaron Kulkis wrote:
This functionality is actually used by some programmers -- they will open() a new file in /tmp (which creates a pathname /tmp/somefilename), then they remove the file (while still having the open file handle). This effectively hides the file from practically everything on the system -- it's a way of preventing a tmp file from accidentally being corrupted by ANY other processs (other than a super-user process writing out in kernal memory).
As does the tmpfile(3) call. Very handy feature for not leaving garbage files around the place when a program exits in an unexpected fashion. -- Roger Oberholtzer OPQ Systems / Ramböll RST Ramböll Sverige AB Kapellgränd 7 P.O. Box 4205 SE-102 65 Stockholm, Sweden Office: Int +46 8-615 60 20 Mobile: Int +46 70-815 1696 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Aaron Kulkis wrote:
Jaco Carlson wrote:
Can you safely delete all files in /tmp? Yes. No!
Any files which are still in use will be in an OPEN status. The process which has the file open will have a handle to the file, and accesses the file through the handle (not the pathname). Wrong. You are forgetting about Shell scripts. AFAIK the bash does not even have the concept of file handles, so all programs reference files by their name. As an example, take /sbin/conf.d/SuSEconfig.postfix which creates a directory in /tmp and references files by name. Deleting everything in /tmp while scripts like this are running may lead to completely undefined results. Especially because many scripts do not check for errors when writing.
Even if you have a program written in C/C++ that uses file handles all the time: What happens to the directories they create in /tmp? The directories get deleted and next time the program wants to create a file in that directory it will fail! And what happens if different layers of abstraction within a program close and re-open files in /tmp? Deleting only old files may also cause problems if you have shell scripts that run for a long time. On a desktop machine, these could be shell wrappers around GUI applications (used e.g. by Firefox/Seamonkey). If you only suspend/resume your system instead of shutting it down, this script may be running for days or weeks if the application does not get closed, crashes or you have to update your kernel. The only way I know of that is 100.0% FHS compliant (see [1]) is to wipe /tmp at boot time and leave it alone at all other times. This can be configured in /etc/sysconfig/cron as Josef Assad already wrote. Regards nordi [1] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 14 November 2007 16:27:17 nordi wrote:
Aaron Kulkis wrote:
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
Yes.
No!
Any files which are still in use will be in an OPEN status. The process which has the file open will have a handle to the file, and accesses the file through the handle (not the pathname).
Wrong. You are forgetting about Shell scripts.
Not to mention pipes and other things that aren't necessarily kept open all the time. After deleting /tmp/kde-<username> and /tmp/.ICE-unix the desktop wouldn't work quite so well. VirtualBox also uses sockets in /tmp to communicate, and it's fairly irrelevant if the server holds it open if the client can't see it anymore So no, it's not a very good idea to clear out /tmp while logged in. Safest (not strictly necessary, but better safe than sorry) is to go to runlevel 1, clean it out, then back to 5 Anders -- Madness takes its toll -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2007-11-13 at 08:04 +0200, Jaco Carlson wrote:
Can you safely delete all files in /tmp?
use sysconfig-cron to clean up older files in /tmp and /var/tmp It removes weekly (default) old garbage... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (11)
-
Aaron Kulkis
-
Anders Johansson
-
Carlos F Lange
-
Hans Witvliet
-
Jaco Carlson
-
James Knott
-
jdd
-
Jeffrey L. Taylor
-
Josef Assad
-
nordi
-
Roger Oberholtzer