Skip to content

Instantly share code, notes, and snippets.

@simryang
Last active July 16, 2024 05:29
Show Gist options
  • Save simryang/dab2f733af734af5061734b74be4dfcb to your computer and use it in GitHub Desktop.
Save simryang/dab2f733af734af5061734b74be4dfcb to your computer and use it in GitHub Desktop.
wizfi630s with openwrt flash read/write test script
#!/bin/sh
# openwrt WizFi630S 읽기 쓰기 테스트
echo "----------------------------"
date
FILE_COUNT=$(df -h / | awk -F'[^0-9.]+' 'NR==2{print int($4)}')
for i in `seq 1 $FILE_COUNT`; do
dd if=/dev/urandom of=test_file_$i.bin bs=1M count=1 > /dev/null 2>&1
hash=`sha256sum test_file_$i.bin | awk '{print $1}'`
eval file_${i}_sha256=$hash
echo "File $i hash: $hash"
done
echo "---------"
#check if hashes are still the same
for i in `seq 1 $FILE_COUNT`; do
eval hash_2=`sha256sum test_file_$i.bin | awk '{print \$1}'`
echo "File $i hash 2: $hash_2"
eval hash_1=\$file_${i}_sha256
if [ "$hash_1" != "$hash_2" ]; then
echo "File $i hash mismatch"
exit 1
fi
done
echo "DF: "
df -h
echo "DMESG: "
dmesg | grep jffs2 | tail -n 5
rm test_file_*.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment