Detecting hard Drives

Source: Internet
Author: User
Tags disk usage

#!/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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.