Re: freebsd 4.5 partitioning

2004-06-10 Thread Nathan Kinkade
On Thu, Jun 10, 2004 at 06:00:15PM +0100, Brad McGuigan wrote:
 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!
  
 Cheers
  
 Brad
  
 mailto: [EMAIL PROTECTED]

Perhaps the first thing you should do it to find out what is filling up
/var.  You can get a general sense by changing to the /var directory and
issuing the following command:

# du -sh *

This should give you the a tally of how big each file and directory is
that reside directly in /var.  Once you find out where the general
problem lies you can futher use 'du' to isolate the problem or start
probing around manually.  If it turns out that every file is needed then
a quick fix would be to create a new directory on /usr, perhaps /usr/var
and then copy all the files from /var to /usr/var.  The delete the /var
directory and all it's contents.  Then create a symbolic link at / named
var that points to /usr/var:

# cd /  ln -s /usr/var

Nathan


pgpzQPCiDRNX2.pgp
Description: PGP signature


Re: freebsd 4.5 partitioning

2004-06-10 Thread Jerry McAllister
 
 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: [EMAIL PROTECTED]
  
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: freebsd 4.5 partitioning

2004-06-10 Thread Bill Moran
Brad McGuigan [EMAIL PROTECTED] wrote:
 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!

I have a few things to add to the advice others gave:

Compare the output of du -hd1 /var to df -h.  If the amounts are very
different, then you probably have programs deleting files but keeping them open,
this causes the space to never be freed.  In this case, the easy answer is a
reboot, but the _correct_ answer is to track down which program is doing this
and fix it.

If you do the copy/symlink thing, make sure you reboot in single user mode
first, otherwise you'll have problems with programs that are trying to use
/var while you're doing this.

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]