Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* /usr filesystem overloaded
@ 1996-08-21  4:00 Johan Erlank
  1996-08-21  4:00 ` Marek Pola/1995
  1996-08-23  4:00 ` trimming wtmp (was: /usr filesystem overloaded) Rob McNicholas
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Erlank @ 1996-08-21  4:00 UTC (permalink / raw)



On my server (Alpha 2000) the /usr filesystem is 90% utilized. What files
can I safely delete to make some more room? The df shows that I have
83152 512k blocks available.

And I'm desperate!

Rgds,

Johan E.


-----------------------------------------------------------------------
|| Johan Erlank    |Telephone number |Internet: j_erlank@sames.co.za ||
|| MIS Dept.       |+27+12 333-6021  |                               ||
|| SAMES (Pty) Ltd |   012 333-6021  |                               ||
-----------------------------------------------------------------------
My opinions are my own. If my employer wanted it to be his, he would
have said so.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: /usr filesystem overloaded
  1996-08-21  4:00 /usr filesystem overloaded Johan Erlank
@ 1996-08-21  4:00 ` Marek Pola/1995
  1996-08-22  4:00   ` Hendrik Roepcke
  1996-08-23  4:00 ` trimming wtmp (was: /usr filesystem overloaded) Rob McNicholas
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Pola/1995 @ 1996-08-21  4:00 UTC (permalink / raw)



Johan Erlank wrote:
> 
> On my server (Alpha 2000) the /usr filesystem is 90% utilized. What files
> can I safely delete to make some more room? The df shows that I have
> 83152 512k blocks available.
> 

# rm /usr/adm/crash/*
# cp /dev/null /usr/adm/messages
# cp /dev/null /usr/adm/[uv]tmp

/Marek Pola
Tetra Pak, Lund, Sweden



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: /usr filesystem overloaded
  1996-08-21  4:00 ` Marek Pola/1995
@ 1996-08-22  4:00   ` Hendrik Roepcke
  0 siblings, 0 replies; 4+ messages in thread
From: Hendrik Roepcke @ 1996-08-22  4:00 UTC (permalink / raw)



Marek Pola/1995 <sepolam@mailbox.swipnet.se> writes:

>Johan Erlank wrote:
>> 
>> On my server (Alpha 2000) the /usr filesystem is 90% utilized. What files
>> can I safely delete to make some more room? The df shows that I have
>> 83152 512k blocks available.
>> 

># rm /usr/adm/crash/*

ok...
># cp /dev/null /usr/adm/messages

tailing them is better IMHO

># cp /dev/null /usr/adm/[uv]tmp

is here a better way to cut them down?



Hendrik

-- 
Panther in the Jungle           __..--''``\--....___   _..,_  
-BELIEVE AND DECEIVE-      _.-'    .-/";  `        ``<._  ``-+'~=.
http://www.ang-physik  _.-' _..--.'_    \                    `(^) )
.uni-kiel.de/~hendrik ((..-'    (< _     ;_..__               ; `'



^ permalink raw reply	[flat|nested] 4+ messages in thread

* trimming wtmp (was: /usr filesystem overloaded)
  1996-08-21  4:00 /usr filesystem overloaded Johan Erlank
  1996-08-21  4:00 ` Marek Pola/1995
@ 1996-08-23  4:00 ` Rob McNicholas
  1 sibling, 0 replies; 4+ messages in thread
From: Rob McNicholas @ 1996-08-23  4:00 UTC (permalink / raw)



Someone asked if there was a better way to maintain the wtmp file
instead of just truncating it.  Attached is a script i wrote many
years ago which prunes records from the top of the file, leaving the
most recent records; i have been using it on our Ultrix 4.2 systems
ever since.  Don't know what will happen under DU.  Use at your own
risk.

-rob

#!/bin/csh -f
# usage: trimwtmp [numrec]
# script to trim wtmp
# Rob McNicholas, 1/30/91
# version of 3/18/92
#
# Deletes the first _numrec_ entries from the /usr/adm/wtmp file.
# If _numrec_ is not specified, 1000 is the default.
#
# Suggested use is as a crontab entry, e.g.
# 42 4 15,30 * * sh /usr/etc/trimwtmp 2>&1 | Mail -s "wtmp trim" root
#
# Bugs:
#       Doesn't check to be sure argument is an integer
#

# the default number of records to trim
set numrec_default = 1000
# size of one wtmp record
set recsize = 36
# file to act on
set wtmpfile = /usr/adm/wtmp

# current size of file
set filesize = `wc -c $wtmpfile`
# trim off file name from wc's output
set filesize = $filesize[1]

# number of records to delete
if ( $#argv == 0 ) then
        # user didn't specify how many records, so use default
        set numrec_del = $numrec_default
else if ($#argv == 1) then
        # use number from command line (and hope it's a number!)
        set numrec_del = $1
else
        echo "Usage: $0 [numrec]"
        exit (1)
endif

echo "Trimming $numrec_del records"

# current number of records in the file
@ cur_rec = `expr $filesize / $recsize`
# number of records to keep is cur_rec - numrec_del
@ keep = `expr $cur_rec - $numrec_del`

if ($keep < 0) then
        echo -n "Tried to delete more records ($numrec_del) than actually "
        echo "exist ($cur_rec)"
        exit (1)
else
        # put what we are deleting in a 'old' file
        dd if=$wtmpfile of=/usr/adm/wtmp.old bs=$recsize count=$numrec_del
        # put what we want to keep in a temporary file
        dd if=$wtmpfile of=/usr/adm/wtmp.$$ bs=$recsize skip=$numrec_del
        # trash the original file and replace with our shortened version
        mv -f /usr/adm/wtmp.$$ $wtmpfile
        # compress the 'old' data (-f forces overwrite if file already exists)
        compress -f /usr/adm/wtmp.old
        # say what happened
        echo "Successfully trimmed $numrec_del records from $wtmpfile"
        echo "Old records are in /usr/adm/wtmp.old.Z"
        exit(0)
endif

# EOF: trimwtmp



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-08-23  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-08-21  4:00 /usr filesystem overloaded Johan Erlank
1996-08-21  4:00 ` Marek Pola/1995
1996-08-22  4:00   ` Hendrik Roepcke
1996-08-23  4:00 ` trimming wtmp (was: /usr filesystem overloaded) Rob McNicholas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox