Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2004 13:45:13 -0400 (EDT)
From:      Jerry McAllister <jerrymc@clunix.cl.msu.edu>
To:        brad@corvu.co.uk (Brad McGuigan)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: freebsd 4.5 partitioning
Message-ID:  <200406101745.i5AHjEo17171@clunix.cl.msu.edu>
In-Reply-To: <1249F5F8C68AF54B8A4258F8EADC8FAA5BDCE4@ns0.ad.corvu.co.uk> from "Brad McGuigan" at Jun 10, 2004 06:00:15 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hi,
>  
> Hope someone out there can help me. I have been charged with looking
> after a freebsd 4.5 server and have come across a problem I am not sure
> how to resolve.
>  
> Basically, the /var filesystem is 108% full. I have free space on
> another filesystem (/usr) and would like to transfer some of this
> across. Is this possible? If so, can someone point me in the direction
> of instructions to do this?
>  
> I am fairly new to this but keen on learning!

The first thing I would do is find out what is taking up all the space.
Very often it is either one of the logs (in /var/log) that are not rotating 
off or Email (in /var/mail and /var/spool/mqueue).   But it could be
other things, especially if you are running a database server.

Log in, make yourself root, cd to /var and run du
  du -sk *
Then cd in to the biggest directories and do it again.
Keep going down[up?] the tree until you find some things that seem
way out of line. 
Then you have to decide what to do with it.   
If it is a log file that got too big, maybe all you have to do
is clean it out - if some process just ran away for a while.  Then,
just nuke it and replace it with an empty one - some loggers won't
create a new log file if one is not there already.
Maybe you have to set up log rotation.  See syslog, syslogd, syslog.conf,etc
If it is /var/mail then maybe some people have to clean out Email boxes.
If it is /var/spool/mqueue, then you will have to figure out why Email
is not getting delivered.
   etc.

If it turns out that you can't just clean some left over stuff up, but
that you really need more space, then you can move some stuff in to
another file system and make a soft link to it quite easily.  I would
be reluctant to do this with /var/log because it might mean that if
two file systems need to be available to do logging, there is just a
larger chance of something not being able to log and maybe not running
because of it.

But, lets say you have MySQL going and /var/db is just growing too much
for where it is living.   The nicest thing would be if you had more
disk to throw at it, but the process is the same if you just move it
to a current file system with extra space (/usr you indicated above).
So, I will make an example imagining that you had another disk and
created a very large file system which you mount as '/work'.

Presuming you have done everything to add the disk and filesystem
 (fdisk, disklabel, newfs, edit /etc/fstab, mount /work)
Also, I have a sort of naming convention that helps me keep track
of stuff.  You can name things as  you please.

Tar up everything in /var/db        | Note that you can do this by
  cd /var/db                        | piping a tar -cp -
  tar -cpf /work/db.tar             | to a tar -xp -
Then go in to /work and untar it.   | but somehow I always feel safer
  cd /work                          | to use the intermediate file if
  mkdir var.db                      | I have enough room - it requires 
  cd var.db                         | twice as much space in the new file
  tar -xpf ../db.tar                | system temporarily
Now go make the link
  cd /var                           | Again, just being overly cautious
  mv db db.old                      | preserving the old db while checking
  ln -s /work/var.db db
Check things out by cd-ing to it and making sure things are all 
there - maybe use your datebase stuff a bit to make sure it is happy.
  cd /var/db
  pwd               should put you in /work/var.db
Then, if everything is all good, clean up after yourself
  cd /var
  rm -rf db.old
  cd /work
  rm db.tar

That should be all it needs.  
If you put the copy in /usr instead of /work, just substitute that
part in the above.

////jerry

>  
> Cheers
>  
> Brad
>  
> mailto: brad@corvu.co.uk
>  
> _______________________________________________
> 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"
> 
> 



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