Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Dec 2004 15:53:40 -0600
From:      "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
To:        kiffin.gish@planet.nl
Cc:        freebsd-newbies@freebsd.org
Subject:   Re: Root directory filling up...
Message-ID:  <41BE0F64.7060303@daleco.biz>
In-Reply-To: <41BDF27C.6010807@planet.nl>
References:  <000001c4e052$8a046360$9900000a@ZGISH> <41BC81CF.1000201@nbritton.org> <41BDF27C.6010807@planet.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Kiffin Gish wrote:

> Nikolas Britton wrote:
>
>> Kiffin Gish wrote:
>>
>>> I recently decided to dump windows and take a much deserved breather 
>>> with
>>> FreeBSD. So I installed 5.3 and was in for a real treat!
>>>
>>> However, I created a /-directory with 4G and installed the complete 
>>> ports
>>> stuff from the CD. Now my root directory is almost filled up (after I
>>> installed all the Gnome Desktop stuff).
>>>
>>> I always do a make clean. Is there an easier way to only keep the ports
>>> stuff that is 'really' required?
>>>
>>> I noticed that there are tons of tarballs etc. in the 
>>> /usr/ports/distfiles
>>> directory. Is it safe to delete all of these?
>>>
>>> Are there any other suggestions to keep my root directory from 
>>> filling up?
>>>
>> What do you mean / is filling up? the default during install is to make
>> 5 partitions /, Swap, /tmp, /var, and /usr.
>>
>> See mine for example:
>> Filesystem     Size    Used   Avail Capacity  Mounted on
>> /dev/ad0s1a    739M     64M    616M     9%    /
>> devfs                1.0K    1.0K      0B   100%    /dev
>> /dev/ad0s1e    739M     15M    665M     2%    /tmp
>> /dev/ad0s1f     69G     25G     38G    40%    /usr
>> /dev/ad0s1d    739M     59M    621M     9%    /var
>> /dev/ad1s1      28G     24G    3.8G    86%    /mnt
>> linprocfs          4.0K    4.0K      0B   100%    /usr/compat/linux/proc
>>
>> The most you should need for / is 128MB (I think that is default during
>> install)
>>
>>
>> please sent the output of these commands "df -h", "more /etc/fstab", and
>> "disklabel ad0s1"
>>
> bash-2.05b$ df -h
> Filesystem     Size    Used   Avail Capacity  Mounted on
> /dev/ad0s4a    3.9G    2.5G    1.1G    70%    /
> devfs          1.0K    1.0K      0B   100%    /dev
> /dev/ad0s4d    7.4G    5.9M    6.8G     0%    /home
>
> This was the recommended setup according to the book The Complete 
> FreeBSD, but now I realize this is probably not the best choice.
>
> bash-2.05b$ more /etc/fstab
> # Device                Mountpoint      FStype  Options         
> Dump    Pass#
> /dev/ad0s4b             none            swap    sw              0       0
> /dev/ad0s4a             /               ufs     rw              1       1
> /dev/ad0s4d             /home           ufs     rw              2       2
> /dev/acd0               /cdrom          cd9660  ro,noauto       0       0
>
> su-2.05b# disklabel ad0s1
> disklabel: /dev/ad0s1: no valid label found


That would need to be `disklabel /dev/ad0s4`, then.

As to the distfiles question, you can safely remove all
of them as long as you don't mind downloading them
again if, for some reason, something needs to be
recompiled.

Your real problem is that you've got /tmp (temporary
disposable stuff, generally), /var/ (mail, logs, database
storage, etc.) and /usr (programs, source, documents,
the ports tree, the buildworld target directory, etc), all
in your root partition, which is just barely big enough to
hold all that stuff unless you do your housekeeping very
regularly (and thoroughly).

A possible hack, in case you don't wish to backup and
reinstall, or learn about growfs(8), [which may be what
Nick is getting at by asking for disklabel output]:

Move some stuff to your /home partition, and then
create symlinks to it from its original location.

Some candidates:  /tmp, /var/log, /root/, /usr/ports,
/usr/src, /usr/obj, /usr/local ...

Now, I can't say which would be best; it depends
on what's filling up so fast (probably /usr, if you've
added X, or really many ports at all) and there might
be some security or other issues I'm not aware of,
but it's a valid strategy for at least the short term.

So, let's say we wanted to move the ports tree and
our source tree to /home.  As root:

# cd /usr
# mv ports /home/
# mv src /home/
# ln -s /home/ports ports
# ln -s /home/src src

Like I said, it's a hack, but it's an available one ;-)

Another possibility, though it's possibly more
nerve wracking, would be to do something like this:

1.  Drop to single user mode in console.
2.  Do something like this:

change /etc/fstab from:
    /dev/ad0s4d             /home           ufs     rw              
2       2
to:
    /dev/ad0s4d             /usr           ufs     rw              
2       2

Then:
#mkdir /home/home
#mv /home/* /home/home/
   (*note that this will give you one error message,
    but should still work.)
#mv /usr/* /home

and then reboot.  After rebooting, you will need
to make sure that it's possible to get to /usr/home by
typing "cd /home", so another symlink would be required.
Note that I said, this could be scary --- I don't foresee
any potential problems, but if you've never had
to recover from a fuzted command using only
/bin/sh and the contents of /, it can be a hair-raising
experience.

Maybe Nick can chime in and say what he thinks;
[or someone else --- maybe you should've asked the
questions@freebsd.org mailing list, instead of newbies]
It might be that growfs isn't that difficult and it is,
after all, designed for this purpose.

HTH,

Kevin Kinsey



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41BE0F64.7060303>