Re: How to clean up the file system?

Merlin wrote:
Hi there,

I am trying to clean up the files not needed on my server. Does somebody
know what the command is to find files on the system that are bigger than 1 MB?
I usually use ls -h to see the filesize of each file within a directory.

What I do not know how to do is:
1. find out the complete file size of a directory including all files belonging
to it.

du -h --max-depth=1 /dir

2. crawl a directory for files that are bigger than 1 MB e.g.

ls -AlFShr /dir |grep M
This will also catch all other files with a M in it.

Wiser might be to sort on `last changed`. That way you can see what is
added and perhaps why.
Somehow my filesystem is almost full. Especially hda5. No idea how that swoll up
to almost 100%. The server starts crashing once 100% are reached. I had this 2
times. But I can not find files that I can delete within /usr

Here is the df -h output:

Filesystem Size Used Avail Use% Mounted on
/dev/hda1 510M 181M 303M 38% /
/dev/hda5 4.9G 4.7G 245M 96% /usr
/dev/hda6 4.9G 310M 4.6G 7% /var
/dev/hda7 63G 52G 11G 84% /home
tmpfs 501M 5.4M 496M 2% /tmp
tmpfs 20M 0 20M 0% /dev/shm

Also you can use konquror. View, View something > File size view or or
the button with all the pretty colours.

Be carefull with deleting files in /usr. Best first rename them and see
what happens.
Do you have the kernel sources installed? You don't need them anymore,
remove them.

See that /usr is mounted read-only NOTHING should be added to /usr on a
once operating system.
From `man hier`
/usr This directory is usually mounted from a separate
partition. It should hold only sharable, read-only
data, so that it can be mounted by various machines
running Linux.

As a temporary solution, you can do the following:
1) look with du -h --max-depth=1 /usr what the largest directory is
(Asume it is /usr/local)
2) make a directory /home/usr/local
3) copy all from /usr/local lo /home/usr/local
4) rename /usr/local to /usr/local_backup
5) symlink /home/usr/local to /usr/local

Again, /usr should be mounted read-only, so nothing is added.
houghi Please do not toppost
Roses are #FF0000, Violets are #0000FF,
All my base are belong to you. Happy Valentine.