[vox-tech] Resizing Root Partition
Michael J Wenk
vox-tech@lists.lugod.org
Tue, 23 Sep 2003 10:36:24 -0700
On Tue, Sep 23, 2003 at 10:14:06AM -0700, Mark K. Kim wrote:
> Your root is taking up too much space. My primary system uses only 125MB
> in root, even though I don't have a separate /tmp. I'd look into why it's
> so big.
>
> Some ideas:
> 1. Unmount everything but root (easier yet, run in single-user
> mode). See if you got anything in /usr, /tmp, and /var. They
> should be empty.
I agree with /tmp and /usr, but whenever I have had a seperate /var, I
always have a small directory structure under it. Some programs, like
vi for example, will not run w/o a /var/tmp. I think I put a /var/tmp,
/var/spool/, and /var/log in there.
> 2. If you got /opt or /pkg, move them to /usr and symlink.
>
> 3. Your root home (probably /root or /) should stay pretty
> small. Move things you don't need out of it
> (for example, downloaded files.)
It is bad to have root's homedirectory on /. What I do is move it to
/home/root and symlink /root to it. I have never encountered an issue
where I wanted a seperate /root on linux, and those systems I have
encountered issues with, root's homedir is /
> 4. Unmount everything but root, and type:
>
> cd /
> du -sH *
>
> which should tell you how much each directory is using up
> how much space. CD into the big directories and type
> `du -sH *` again, then again, then again until you find
> the culprits. Remove things like coredumps and such.
There's a slightly better(IMHO) way of doing this:
find / -xdev -type f -print | xargs du -sk | sort -rn | head -25
This will give you a list of files that are taking up the most
diskspace. If you switch the type flag to d, it will give you the
directories. I prefer doing it this way as you are comparing apples to
apples, which allows you to use sort -rn to reverse sort the thing and
come up with something that makes some sense. the H option is great for
df, but I don't find it as useful in du... One other thing to note is
that -xdev means do not cross into other filesystems, which allows you
to run this on a running node.
Mike