The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 File system Full
Author: Greg Hicks 
Date:   11-02-03 14:34

Do you know of a quick and simple program or script that can check to see how much space has been used and give a warning before the file system fills up? I am on a HP9000 and had the file system fill up while I was gone.

Thanks,
Greg Hicks
Programmer/Analyst

Reply To This Message
 
 Re: File system Full
Author: k 
Date:   11-02-03 17:27

Well you could do something like this in a script to email you when
a filesystem has reached 90% (adjust to your preference):

IFS="

"
for FILESYSTEM in `df -k`
do
if [ "`echo $FILESYSTEM | awk '{print $5}'`" -gt "90" ]
then
echo $FILESYSTEM | mail -s "Filesystem Notice" you@you.com

fi
done

Reply To This Message
 
 Re: File system Full
Author: Dan Langille 
Date:   11-02-03 17:28

I use NetSaint http://www.freebsddiary.org/netsaint.php for that.

Also, the daily reports sent to root give you the file space used:

Disk status:
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 443454 125704 282274 31% /
procfs 4 4 0 100% /proc

Reply To This Message
 
 Re: File system Full
Author: k 
Date:   11-02-03 18:58

Some slight corrections in my post. In the bracket I needed to add
a "%" sign, and I forgot about procfs being listed in df -k. So
to avoid getting email about the procfs the bracket should look like:

if [ "`echo $FILESYSTEM | awk '{print $5}'`" -gt "90%" && "`echo $FILESYSTEM |awk '{print $1}'`" -ne "procfs"]

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org