#!/bin/bash
# If the hard disk is damaged (echo),I node, hard disk space utilization.
#If the harddrive is damaged (ECHO), the I-node, disk space usage.
cd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} '
i= ' df-i |awk ' nr==3 {print $} '
df= ' df-l |awk ' nr==3 {print $} '
dfg= ' expr $DF/1048576 ' G
If [-Z $CD];then
echo "Unknow:disk"; Exit 3
Else
echo "1" >/tmp/disktest
Et= ' echo $? '
If [$ET-eq 0];then
If [$I-ge 1000000];then
If [$CD-ge];then
echo "Hard disk space was full, hard disk usage is: $CD%, replace Thehard disk"; Exit 2
elif [$CD-ge];then
echo "Harddisk left are: $DFG, hard disk usage is: $CD%"; Exit 1
Else
echo "Hard disk was Ok,hard disk left is: $DFG"; Exit 0
Fi
Else
echo "I-nodes Hasbeen exhausted, the remaining quantity is: $I, replace the hard disk"; exit2
Fi
Else
echo "The hard disk was damaged,replace the hard drive"; Exit 2
Fi
Fi
This article is from the "Operation and maintenance of the Road" blog, please be sure to keep this source http://lrtao2010.blog.51cto.com/10425744/1701934
Detecting hard Drives