Mombu the GNU Linux Forum sponsored links

Go Back   Mombu the GNU Linux Forum > GNU_Linux > proper method to clean house
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 27th May 06:34
ray
External User
 
Posts: 1
Default proper method to clean house


I find that my 10gb Gentoo partition has filled up. I find 1.8gb in
/var/tmp/ccache and 1.2gb in /usr/src. I've been looking at gentoo.org in
the docs section to find appropriate commands to clean things out, but
without luck, so far. Can someone tell me how to do that or at least what
is safe to delete.

thanks
  Reply With Quote


  sponsored links


2 27th May 06:34
az nomad
External User
 
Posts: 1
Default proper method to clean house


the only thing in /usr/src should be kernel and you can only get rid of
it entirely if you won't be building any more packages that depend on it.
What you can do is a 'make mrproper' in it to clean out all the object files.
You can also get rid of all versions other than the current running version.
Do a 'uname -r' to get that information.

You can also get rid of all the unused versions in /lib/modules.
  Reply With Quote
3 27th May 06:34
arthur hagen
External User
 
Posts: 1
Default proper method to clean house


Do not do "make mrproper" for the /current/ kernel, or you won't be able to
emerge 3rd party modules. In /usr/src/linux (which should be a symlink to
the current kernel), do "make clean; make modules_prepare" instead.

To get rid of all kernel versions except the latest you installed:

emerge --prune sys-kernel/gentoo-sources

(Substitute gentoo-sources with the kernel you use -- it could be
hardened-sources or vanilla or bsd or...)

After this, you can rm -r the directories for the versions you removed from under /usr/src/


Just don't get rid of them if there still are kernels using them under
/boot -- sometimes you want to be able to boot into an older kernel.

Another few space savers:

check /usr/portage/distfiles, and remove the older versions of any source
package which you have more than one version of. (Or zonk it all if you
want to, but then you'll have to re-download the packages if rebuilding
anything.)
If you have gentoolkit installed, you might want to clean out
/usr/portage/distfiles automatically by running "eclean-dist" (will only
remove packages that no longer have an ebuild) or "eclean-dist -d" (to
remove everything except what you need for a reinstall).

For ccache, you can do:
# if compiling something, wait until finished.
cd /var/tmp/ccache
rm -f tmp.*
find . -type f -mtime +360 | xargs rm
# adjust 360 to fit your needs - any files that old in days will be removed
ccache -c # this one will take a while

To get rid of left-over files from emerge compiles:
cd /var/tmp/portage
rm -rf *

If running apache:
rm -f /tmp/sess_*

If running mysql:
# Unless you're running replication:
mysql -e "purge master logs before '`date +%Y-%m-%d` 00:00:00'"
# In any case:
/usr/bin/mysqloptimize -As

If using xfs (not the X font server, but the file system), emerge xfsdump
and run:
xfs_fsr -v
# This will defragment all xfs hard drives, which can free up some space
too, due to getting rid of unnecessary extents.

Then there's /var/log/... I recommend using the logrotate package or
similar, and make sure that logs are rotated and compressed every now and
then.

Good luck cleaning!
--
*Art
  Reply With Quote


  sponsored links


4 27th May 06:34
wim cossement
External User
 
Posts: 1
Default proper method to clean house


Also see if /var/log/portage/ is not taking up too much space...

I use this setup and am quite happy with it for my logs:
<begin of /etc/syslog-ng/syslog-ng.conf>
options {
perm(0640);
dir_perm(0750);
create_dirs(yes);

log_fifo_size(4096);

use_fqdn(no);
keep_hostname(yes);
chain_hostnames(no);

sync(0);

stats(43200);
};

source src {
unix-stream("/dev/log");
internal();
pipe("/proc/kmsg");
};

destination messages { file("/var/log/messages/$R_YEAR/$R_MONTH/$R_YEAR-$R_MONTH-$R_DAY"
template("$ISODATE <$FACILITY.$PRIORITY> $MSG\n")
template_escape(no)
);
};

destination console_all { file("/dev/tty12"); };

log { source(src); destination(messages); };
log { source(src); destination(console_all); };
<end of /etc/syslog-ng/syslog-ng.conf>

In order for this to work you must remove /var/log/messages when you
shut down syslog-ng or it won't work.

HTH,

Wimmy
  Reply With Quote
5 27th May 06:34
anthony.youngman
External User
 
Posts: 1
Default proper method to clean house


I'm guessing that /var/tmp means it really is temporary :-)

How big is your swap partition? I deliberately created a 10Gb swap on
my system (I multi-boot, and have allocated an 80Gb disk to Gentoo :-)
so I mounted /tmp as a tmpfs partition.

If you look in fstab, there's probably a partition put there by
default that's tmpfs. Wipe the contents of /var/tmp, edit fstab to
mount it tmpfs, and bingo - every reboot the contents just go away ...
as I find various ...tmp's I'll probably do the same.

Cheers,
Wol
  Reply With Quote
6 27th May 06:34
wim cossement
External User
 
Posts: 1
Default proper method to clean house


So this means that those 10 GB are used as tmpfs mounts when you run out
of memory? But is this not negative for performance?

Wiping various dirs can be done with tmpreaper (that you can put in a
cronjob for instance) and clearing out standard locations for scratch
can be done by setting WIPE_TMP to yes in /etc/conf.d/bootmisc.

Wimmy
  Reply With Quote
7 27th May 06:35
anthony.youngman
External User
 
Posts: 1
Default proper method to clean house


No ...

tmpfs creates a filesystem in ram. If you don't use the files, they
get flushed to swap when you run out of ram. Basically, it's exactly
the same hit to your system as if you had a program that used a lot of
memory, but rarely did anything, so it spends the bulk of its time
swapped out.

Seeing as I've got 768Mb RAM and rarely use anywhere near that (free
RAM stays high!) the hit to my system is near zilch.


I know. I can't be bothered. My system rarely spends that long up, so
I just find it easier to wipe things on shutdown.

Cheers,
Wol
  Reply With Quote
8 27th May 16:32
External User
 
Posts: 1
Default proper method to clean house


Wrong. /var/tmp is supposed to be preserved between reboots. That's
why there's a /tmp and a /var/tmp. If a developer decides something
aught to go into /var/tmp and not /tmp, this is the reason. See
http://www.pathname.com/fhs/ .

Also, remember to remove any packages that are no longer needed with
'emerge --depclean -av'. So if you installed and later remove
evolution, you can get rid of all the junk that came with it.

Mark
  Reply With Quote
9 27th May 20:41
External User
 
Posts: 1
Default proper method to clean house


Wrong. /var/tmp is supposed to be preserved between reboots. That's
why there's a /tmp and a /var/tmp. If a developer decides something
aught to go into /var/tmp and not /tmp, this is the reason. See
http://www.pathname.com/fhs/ .

Also, remember to remove any packages that are no longer needed with
'emerge --depclean -av'. So if you installed and later remove
evolution, you can get rid of all the junk that came with it.

Mark
  Reply With Quote
10 27th May 20:41
External User
 
Posts: 1
Default proper method to clean house


Wrong. /var/tmp is supposed to be preserved between reboots. That's
why there's a /tmp and a /var/tmp. If a developer decides something
aught to go into /var/tmp and not /tmp, this is the reason. See
http://www.pathname.com/fhs/ .

Also, remember to remove any packages that are no longer needed with
'emerge --depclean -av'. So if you installed and later remove
evolution, you can get rid of all the junk that came with it.

Mark
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666