Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file system checking 1

Status
Not open for further replies.

DblBass

IS-IT--Management
Aug 27, 2003
7
0
0
US
I've been using the script below to check the filesystem usage on 20 servers and looking at the output now I want to reduce the amount of lines I look at to just server with over 90% usage on a filesystem.

Is there a way to suppress the col header from the df command?

#!/bin/csh
cp /dev/null ./temp1
set infile = "./main_servers"
foreach abc ( `cat $infile` )
echo "---------------------------------------------" >>temp1
echo "$abc" >>temp1
echo "" >>temp1
rsh $abc df -k -Fufs | awk '{print $6, " ", $5 }' >>temp1
end
 
Try this:

#!/bin/csh
set maxsz=90
cp /dev/null ./temp1
set infile = "./main_servers"
foreach abc ( `cat $infile` )
echo "---------------------------------------------" >>temp1
echo "$abc" >>temp1
echo "" >>temp1
rsh $abc df -k -Fufs|awk '{p=substr($5,1,length($5)-1);if (int(p) >= sz) print $6, " ", $5 }' sz=$maxsz >>temp1
end

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
maybe you could add to your df line:

df -k -Fufs |grep -v Mount |awk {'print $6, " ", $5}'
 
Thanks

Both mods were interesting

I used the one from the awk master with an added ||p==100 to catch full file systems (which we have a ton of)

Now, how do you get users to delete old files?
 
Only with threats to delete their files if over certain quota!

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
DBLBass:Now, how do you get users to delete old files?


I usually find a very big stick being waved frantically round usually works ;-)
 
tell them that you don't discriminate and that if the disks don't get more free space you'll run:

find <partition> -mtime +60 -exec rm {} \;

i.e. anything unmodified for 60 days is gone ...

p.s. make sure you have backups.
 
I tried that once and managed to zap all the user profiles (.login, .profile etc) not the best idea I ever had!
 
fnd <partition> -mtime +60 -exec rm {} \;


That command is very very very dangerous. Mind you I once ran

rm -rf * from / once! Live and learn I guess.

 
hmm ... you could exclude them

find <partition> -type d -name '.*' -prune -o ! -name '.*' -mtime +60 -exec rm {} \;

might work ... at least it does appear to.
 
you could do it on a user by user basis as well ... or do a '! -user root'
 
The way it works around here is IS does not own any data projects do, so we are not allowed to delete any files. All the managers say is buy more disks they are cheap. Go figure. We are a cadds shop and the main problem is a bunch of copies of the same drawing which also makes backups huge.

In fact we never remove user accounts we just disable them. So, that file ownership does not go away. NOT my choice. We have files from users that have been gone 10 years that have not been looked at is 15 years that are still being backedup. Go figure. Last year we got ask to do a recovery of a file that was made in 1992 on a vax system and we did.

GIGO

Joe
 
We have files from users that have been gone 10 years that have not been looked at is 15 years that are still being backedup. Go figure. Last year we got ask to do a recovery of a file that was made in 1992 on a vax system and we did.

Seems you need to establish some kind of 'archiving' system where 'old' files/directories are backed-up to Tape or CD-ROM and an index created in order to recover if needed.

And, then delete these obsolete files!!!

(Cheaper than having them on disk and backing-up htese unused files every time)

Good Luck.

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Oh that we could archive but corporate likes it the way it is now.
 
you can look for accessed time on files, rather than modified time (can't do this on directories) and check for things not accessed in greater than 720 days or something similar.

a year would probably be enough ...

can you do anything to organise the directory structure, this _might_ help stop duplication?
 

I assume you have already compressed these the old files?





----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top