Results 1 to 7 of 7

Thread: space on linux

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    385

    space on linux

    Here's the situation:
    I have a large RedHat Linux installation on a 4.3 gig HDD, and though it has been working fine for a few weeks now, it recently ran out of space to do even simple things such as load, which I found out after rebooting and checking my mail at the shell prompt.

    The question:
    How do I clear up some space for it to properly run without deleting any programs?

    TIA
    Preliminary operational tests were inconclusive (the dang thing blew up)

    \"Ask not what the kernel can do for you, ask what you can do for the kernel!\"

  2. #2
    Priapistic Monk KorpDeath's Avatar
    Join Date
    Dec 2001
    Posts
    2,628
    How do you have it partitioned? What's filing up the disk, log files?
    Mankind have a great aversion to intellectual labor; but even supposing knowledge to be easily attainable, more people would be content to be ignorant than would take even a little trouble to acquire it.
    - Samuel Johnson

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    711
    Well, which partition did you fill up? (I fergets (sic) how RedSplat partitions itself these days by default)

    Easiest means to see what's taking up space is something like:

    % df -k
    This should show you the amount of space on each partition... anything over like 75% should be watched. Things in the 90% range are demanding attention. You can then CD to the partition in-question and do something like:

    % du -ks *
    That will spin the disk for a while and should give you a directory name and the amount of space taken up in each one... there are a few places that typically demand attention on any UN*X system (people please correct me if I've foo'd Redhat vs. Solaris or some other stupid problem):

    /var/spool/mail - where you mail lives when it gets to the system
    /var/spool/mqueue - where outgoing mail is queued
    /var/log - default spot for log files
    /var/tmp - some things like to "swap" here
    /tmp - the real spot for swap
    There's some other "good" spots, I'm sure... though most stuff should normally end up in /var (that's the partition where "variable" files are supposed to live, normally). Mind you, if "/" files up, there's a good chance that your system won't reboot (if it's done by "root," it'll fill up the entire disk and create serious problems - normal (non-root) users won't be able to completely fill a disk, but they can give it enough to cause serious problems, partcularly if they're somewhat knowledgeable).

    Hope this helps, as scatter-brained as it is...
    \"Windows has detected that a gnat has farted in the general vicinity. You must reboot for changes to take affect. Reboot now?\"

  4. #4
    Senior Member cwk9's Avatar
    Join Date
    Feb 2002
    Posts
    1,207
    Linux comes with a bunch of free software. Chances are that you don't use half of it but installed it anyways.
    Its not software piracy. I’m just making multiple off site backups.

  5. #5
    Member
    Join Date
    Jul 2001
    Posts
    62
    I would suggest backing up your logs on a backup media then clear them by using

    cp /dev/null /var/log/logname (where logname is the name of the log you wish to clear)

    also you can clean the tmp directory

    check for any unneeded programs that are installed

    search for core files with the find command (example: find / -name core)
    also search for dead.letter files

    Just a few space saving suggestions.

    Hope it helps
    dAggressor

    It\'s a long life, until you die

  6. #6
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    A better idea is to create a shellscript that TARs + GZips the logs.

    Something like:

    Code:
    #!/bin/sh
    
    LOGDIR="/var/log"       #set log Directory
    ARDATE=`date +%m_%d_%Y` #set the current month_day_year to append to archive name.
    
    #process subdirectories of all the logs.
    for foo in `ls -l $LOGDIR | grep drwx | awk '{print $9}'`
    do
        tar zcvf $LOGDIR/$foo/$foo.$ARDATE.tgz $LOGDIR/$foo/*
    done
    #now process the base log directory.
    tar -zcv -C $LOGDIR -f $LOGDIR/log.$ARDATE.tgz `ls -l $LOGDIR | grep -v drwx | awk '{print $9}'`
    Slap this in a script and call it from cron on say, a weekly basis and it will archive and gzip all of the logs. Then you could have another simple script move them to another directory to be burned to CD or something.

    The sheer amount of automation for logs and etc. that you can achieve under linux is quite impressive.

    Having a script that cleans up your logs on a regular basis is a very good idea, and pivotal to good systems management.
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Posts
    132
    Well ... you COULD always head to / and do an "rm -rf *" There! 4GB free. DON'T actually do this, btw. What you could do is kill everything in /tmp/ or look in your printspooler and kill off old garbage files ... or kill a few users or so - that always worked for me in the SysAdmin days.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •