From 499fd49989fe43de58e1be44655cb17de6ebe551 Mon Sep 17 00:00:00 2001 From: ThomasKaiser Date: Fri, 18 Mar 2016 21:24:34 +0100 Subject: [PATCH] Small fixes for armbianmonitor's storage check mode --- scripts/armbianmonitor/armbianmonitor | 42 +++++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-) mode change 100755 => 100644 scripts/armbianmonitor/armbianmonitor diff --git a/scripts/armbianmonitor/armbianmonitor b/scripts/armbianmonitor/armbianmonitor old mode 100755 new mode 100644 index 1baa041a7e..9b04fcc258 --- a/scripts/armbianmonitor/armbianmonitor +++ b/scripts/armbianmonitor/armbianmonitor @@ -91,6 +91,7 @@ Main() { BOLD="$(tput bold)" NC='\033[0m' # No Color LGREEN='\033[1;32m' + LRED='\e[0;91m' fi fi @@ -202,7 +203,7 @@ ParseOptions() { } # ParseOptions DisplayUsage() { - echo -e "Usage: ${BOLD}${0##*/} [-h] [-b] [-d \$path] [-d] [-m] [-r] [-u]${NC}\n" + echo -e "Usage: ${BOLD}${0##*/} [-h] [-b] [-c \$path] [-d] [-m] [-r] [-u]${NC}\n" echo -e "############################################################################" if [ ${FullUsage} ]; then echo -e "\nDetailed Description:" @@ -681,21 +682,22 @@ CheckCard() { trap "rm -rf \"${TestDir}\" ; exit 0" 0 1 2 3 15 # start actual test, create a small file for some space reserve - fallocate -l 32M "${TestDir}/empty.32m" + fallocate -l 32M "${TestDir}/empty.32m" 2>/dev/null || dd if=/dev/zero of="${TestDir}/empty.32m" bs=1M count=32 status=noxfer >/dev/null 2>&1 # Start writing - echo -e "Now starting to write to the card, please be patient, this might take a very long time" + echo -e "Starting to fill ${DeviceName} with test patterns, please be patient this might take a very long time" f3write "${TestDir}" | tee /tmp/CheckCard.log - touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}Test stopped, read-only filesystem" ; dmesg | grep 'I/O error' ; echo -e "${NC}" ; exit 1) + touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}${LRED}Test stopped, read-only filesystem\n$(dmesg | grep 'I/O error')${NC}" ; exit 1) rm "${TestDir}/empty.32m" # Start verify echo -e "\nNow verifying the written data:" f3read "${TestDir}" | tee -a /tmp/CheckCard.log - touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}Test stopped, read-only filesystem" ; dmesg | grep 'I/O error' ; echo -e "${NC}" ; exit 1) + touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}${LRED}Test stopped, read-only filesystem\n$(dmesg | grep 'I/O error')${NC}" ; exit 1) rm "${TestDir}/"*.h2w - echo -e "\nStarting iozone tests:" + echo -e "\nStarting iozone tests. Be patient, this can take a very long time to complete:" cd "${TestDir}" - iozone -e -I -a -s 100M -r 4k -r 512k -r 16M -i 0 -i 1 -i 2 "${TestDir}" | tee -a /tmp/CheckCard.log - touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}Test stopped, read-only filesystem" ; dmesg | grep 'I/O error' ; echo -e "${NC}" ; exit 1) + # iozone -e -I -a -s 100M -r 4k -r 512k -r 16M -i 0 -i 1 -i 2 | tee -a /tmp/CheckCard.log | cut -c-80 | tail -f -n +30 + iozone -e -I -a -s 100M -r 4k -r 512k -r 16M -i 0 -i 1 -i 2 | tee -a /tmp/CheckCard.log + touch "${TestDir}/.starttime" || (echo -e "\n${BOLD}${LRED}Test stopped, read-only filesystem\n$(dmesg | grep 'I/O error')${NC}" ; exit 1) echo -e "\n${BOLD}The results from testing ${DeviceName} (${FileSystem}):${NC}" egrep "Average|Data" /tmp/CheckCard.log | sort -r echo " random random" @@ -704,12 +706,16 @@ CheckCard() { # check health echo -e "\n${BOLD}Health summary: \c" - grep -q "Data LOST: 0.00 Byte" /tmp/CheckCard.log && echo "OK" || \ - (echo -e "${DeviceName} is faulty. Replace it as soon as possible!" ; \ + grep -q "Data LOST: 0.00 Byte" /tmp/CheckCard.log && echo "${LGREEN}OK" || \ + (echo -e "${LRED}${DeviceName} is faulty. Replace it as soon as possible!" ; \ grep -A3 "^Data LOST" /tmp/CheckCard.log) # check performance RandomSpeed=$(awk -F" " '/102400 4/ {print $7"\t"$8}'