33
install_shell/hdparm.sh
Executable file
33
install_shell/hdparm.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# a script used get SATA/IDE hard disk parameters.
|
||||
# Li Wenming <wmli@linx-info.com>
|
||||
# 2013-05-20
|
||||
|
||||
if [ "`id -u`" = "0" ]; then
|
||||
DISK=$(fdisk -l|grep Disk|grep dev|awk -F':' '{print $1}'|awk '{print $NF}')
|
||||
DATE=$(date +%Y-%m-%d)
|
||||
DF=DiskInfo_$(hostname)_${DATE}.txt
|
||||
echo 'DiskInfo' > $DF
|
||||
echo "======================================================"|tee -a $DF
|
||||
if [ $(which hdparm) ];then
|
||||
for i in $DISK
|
||||
do
|
||||
echo -n "$i "|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'device size with M = 1000\*1000:'|awk '{print $(NF-1),$NF}')"|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'Model Number:')"|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'Serial Number:')"|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'Transport:')"|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'Form Factor:')"|tee -a $DF
|
||||
echo "$(hdparm -I $i 2>/dev/null|grep 'Nominal Media Rotation Rate: 7200')"|tee -a $DF
|
||||
echo "------------------------------------------------------"|tee -a $DF
|
||||
done
|
||||
else
|
||||
echo "hdparm: command not found!"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
echo “Please use the root user to execute $0!”
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user