You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
5 years ago
|
#!/bin/sh
|
||
|
|
||
|
DEVICES="$(lsblk -l -x NAME -o NAME | tail -n +2 | cut -d\ -f1 | grep -v '[0-9]' | tr '\n' ' ') $(find /dev -maxdepth 1 -type b -name 'md*'|sort -V|rev|cut -d/ -f1|rev) $(find /dev -maxdepth 1 -type b -name 'dm-*'|sort -V|rev|cut -d/ -f1|rev)"
|
||
|
|
||
|
case ${1} in
|
||
|
t)
|
||
|
|
||
|
sudo echo -n '╔══════╤'
|
||
|
for DEVICE in $DEVICES; do
|
||
|
printf "%6s╤" "══════"
|
||
|
done
|
||
|
|
||
|
echo -ne '\b╗\n║DEVICE│'
|
||
|
for DEVICE in $DEVICES; do
|
||
|
printf "%6s│" "${DEVICE}"
|
||
|
done
|
||
|
|
||
|
echo -ne '\b║\n╟──────┼'
|
||
|
for DEVICE in $DEVICES; do
|
||
|
printf "%6s┼" "──────"
|
||
|
done
|
||
|
|
||
|
echo -ne '\b╢\n║MB/sec│'
|
||
|
for DEVICE in $DEVICES; do
|
||
|
printf "%6s│" "$(sudo hdparm -t --direct /dev/${DEVICE} 2> /dev/null | grep 'MB/sec' | cut -d= -f2 | sed 's/\s\s*//g;s/MB\/sec//g')"
|
||
|
done
|
||
|
|
||
|
echo -ne '\b║\n╚══════╧'
|
||
|
for DEVICE in $DEVICES; do
|
||
|
printf "%6s╧" "══════"
|
||
|
done
|
||
|
|
||
|
echo -ne '\b╝\n'
|
||
|
;;
|
||
|
*)
|
||
|
|
||
|
sudo echo -n "DISK SPEED (MB/s): "
|
||
|
for DEVICE in $DEVICES; do
|
||
|
echo -n "${DEVICE}="
|
||
|
echo -n "$(sudo hdparm -t --direct /dev/${DEVICE} 2> /dev/null | grep 'MB/sec' | cut -d= -f2 | sed 's/\s\s*//g;s/MB\/sec//g'),"
|
||
|
done
|
||
|
echo -e '\b \b'
|
||
|
|
||
|
;;
|
||
|
esac
|