Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Oct 2010 11:32:33 -0700
From:      Devin Teske <dteske@vicor.com>
To:        Caleb Stein <caleb.stein@me.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Clean up / filesystem
Message-ID:  <E5995B2C-E7BE-478C-8CA0-61BBEAA0B73F@vicor.com>
In-Reply-To: <op.vkbisimcesa1c5@win7x64.mshome.net>
References:  <op.vkakpz1j0i70i3@win7x64.mshome.net> <19632.463.52069.211565@jerusalem.litteratus.org> <op.vkbisimcesa1c5@win7x64.mshome.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On Oct 9, 2010, at 9:58 AM, Caleb Stein wrote:

> On Fri, 08 Oct 2010 22:46:55 -0700, Robert Huff <roberthuff@rcn.com> =
wrote:
>=20
>>=20
>> Caleb Stein writes:
>>=20
>>> I'm constantly getting the message, ":/ write failed, filesystem
>>> is full", so I did df, and it said that my / filesystem was at
>>> 108%.  What files can I delete to free some space?
>>=20
>> 	Start by checking the contents of /tmp.
>> 	Any *.core in /root you don't recognize is suspect.
>> 	After that?  Try:
>>=20
>> 	du -x / | sort -n -r | head -n 40
>>=20
>> 	Look in those directories.
>>=20
>>=20
>> 					Robert Huff
>>=20
>> _______________________________________________
>> freebsd-questions@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to =
"freebsd-questions-unsubscribe@freebsd.org"
>=20
> So is it safe to do "rm -rf /tmp/*"?


Generally yes, though it's always safest to check to make sure you're =
not deleting any files that actively held open by running processes. You =
can do this by:

	fstat -f /tmp

(or if /tmp is not it's own filesystem -- if it lives on the `/' =
partition that is)

	fstat | grep /tmp

If you a find a process that has open file descriptors in `/tmp', you =
can do two things:

1. You can kill the process (the third column in the output of fstat(1) =
is the process ID or PID). Continue until no processes are left holding =
open file-descriptors in `/tmp'. Then it would be safe to wipe =
everything in that directory.

2. You can avoid removing the files that are open. The sixth column in =
the output of fstat(1) is the inode/inum of the file on the device/mount =
(the device/mount column is the fifth column, just to the left of the =
inode/inum column). You can descend into `/tmp' and say `ls -li' to show =
the inode numbers, or you can say `find /tmp -inum INODE' to find the =
associated file. You would want to avoid deleting that file because a =
running process has it open.


In addition, there's an alternative way to clear the temporary files of =
a system (FreeBSD-5.0 and higher):

=09
	(as root or with sudo(8)) sh -c 'clear_tmp_enable=3DYES; =
/etc/rc.d/cleartmp start'

NOTE: Unless you've customized your rc.conf(5) files to change the =
defaults, clear_tmp_enable defaults to "NO" and clear_tmp_X defaults to =
"YES" (see `/etc/defaults/rc.conf'), so passing a "start" to this rc.d =
script will (by default) only clear out the X related temporary files =
located in `/tmp', whereas the above command will get the rc.d script to =
a full cleanup of `/tmp' (regardless of whether you've customized =
rc.conf(5) or not).

The rc.d script (cleartmp) _does_ do a slightly more sophisticated =
clean-up of the `/tmp' directory in that it will not kill-off the =
`lost+found' directory if it exists, and will also ignore =
`quota.user'/`quota.group' files. Lastly, it will recreate the X11 =
socket directories (`.X11-unix', `.ICE-unix', `.XIM-unix', and =
`.font-unix').

In addition, the above command is better in that it will clean up files =
beginning with `.' whereas your command which only specified "rm -Rf =
/tmp/*" won't get files that begin with `.' (of which there may be =
numerous).

Last but not least, if your system is running XFree86 or Xorg, running =
either the "rm -Rf /tmp/*" -or- the cleartmp rc.d script is bad while =
the X server is running since it might cause the running X server to =
lose its mind (these are lock-files in `/tmp' that shouldn't be removed =
while the server is running). Again, fstat(1) is your friend. Though, =
alternatively you could bring the X server down temporarily, clear =
`/tmp' however you prefer, and then restart the `X' server.

If this is all too overwhelming, you could always safely just clear =
`/tmp' and then immediately reboot. Or, plop clear_tmp_enable=3D"YES" =
into rc.conf(5), reboot, and the system will clear `/tmp' for you on =
boot-up.
--
Devin

(full sig at bottom)




> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to =
"freebsd-questions-unsubscribe@freebsd.org"

--
Cheers,
Devin Teske

-> CONTACT INFORMATION <-
Business Solutions Consultant II
FIS - fisglobal.com
510-735-5650 Mobile
510-621-2038 Office
510-621-2020 Office Fax
909-477-4578 Home/Fax
devin.teske@fisglobal.com

-> LEGAL DISCLAIMER <-
This message  contains confidential  and proprietary  information
of the sender,  and is intended only for the person(s) to whom it
is addressed. Any use, distribution, copying or disclosure by any
other person  is strictly prohibited.  If you have  received this
message in error,  please notify  the e-mail sender  immediately,
and delete the original message without making a copy.

-> FUN STUFF <-
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GAT/CS d(+) s: a- C++(++++) UB++++$ P++(++++) L++(++++) !E--- W++ N? o? =
K- w O
M+ V- PS+ PE Y+ PGP- t(+) 5? X+(++) R>++ tv(+) b+(++) DI+(++) D(+) G+>++ =
e>+ h
r>++ y+=20
------END GEEK CODE BLOCK------
http://www.geekcode.com/

-> END TRANSMISSION <-




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E5995B2C-E7BE-478C-8CA0-61BBEAA0B73F>