mirror of
https://github.com/byReqz/stocheck.git
synced 2024-11-14 19:53:15 +00:00
add device map, add root user check, tweak drive counting
This commit is contained in:
parent
cb730c9e3d
commit
0fe6fbe657
20
stocheck.sh
20
stocheck.sh
@ -8,14 +8,21 @@ if [[ ! "$0" =~ "bash" ]];then
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ $(whoami) != "root" ]];then
|
||||||
|
echo "-----------------------------------------"
|
||||||
|
echo "ERROR: This script should be run as root."
|
||||||
|
echo "-----------------------------------------"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
while [ -z "$1" ]; do
|
while [ -z "$1" ]; do
|
||||||
raidcheck="$(lspci | grep -E 'LSI|3Ware|Adaptec|Smartraid')"
|
raidcheck="$(lspci | grep -E 'LSI|3Ware|Adaptec|Smartraid')"
|
||||||
if [[ -z "$raidcheck" ]];then
|
if [[ -z "$raidcheck" ]];then
|
||||||
|
echo "-------------------------------------------- Device Map --------------------------------------------"
|
||||||
|
lsblk -f
|
||||||
|
echo "----------------------------------------------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
if [[ -n $(ls /sys/block | grep sd) ]];then
|
if [[ -n $(ls /sys/block | grep sd) ]];then
|
||||||
echo "=== sata drive check: ==="
|
echo "=== sata drive check: ($(ls -l /sys/block | grep sd | wc -l) found) ==="
|
||||||
echo "-------------------------"
|
|
||||||
echo "$(ls -l /sys/block | grep sd | wc -l) Drives found"
|
|
||||||
echo "-------------------------"
|
|
||||||
for x in {a..z};do
|
for x in {a..z};do
|
||||||
scan=$(smartctl --scan)
|
scan=$(smartctl --scan)
|
||||||
if [[ -n $(echo $scan | grep /dev/sd$x) ]];then
|
if [[ -n $(echo $scan | grep /dev/sd$x) ]];then
|
||||||
@ -36,10 +43,7 @@ while [ -z "$1" ]; do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -n $(ls /dev | grep nvme) ]];then
|
if [[ -n $(ls /dev | grep nvme) ]];then
|
||||||
echo "=== nvme drive check: ==="
|
echo "=== nvme drive check: ($(ls -l /sys/block | grep nvme | wc -l) found) ==="
|
||||||
echo "-------------------------"
|
|
||||||
echo "$(ls -l /sys/block | grep nvme | wc -l) Drives found"
|
|
||||||
echo "-------------------------"
|
|
||||||
for x in {0..4};do
|
for x in {0..4};do
|
||||||
scan=$(smartctl --scan)
|
scan=$(smartctl --scan)
|
||||||
if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then
|
if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then
|
||||||
|
Loading…
Reference in New Issue
Block a user