|
|
@ -26,16 +26,16 @@ BLK_INFO="$(echo "${BLK_INFO}" | awk '{t=$1; $1=$2; $2=t; print;}')"
|
|
|
|
echo "${BLK_INFO}" | while read -r LOCATION BLOCKDEV; do
|
|
|
|
echo "${BLK_INFO}" | while read -r LOCATION BLOCKDEV; do
|
|
|
|
DEVICE_ID="$(ls -l --color=never /dev/disk/by-id | sed 's/ \+/ /g' | grep -v 'nvme-eui\|wwn-' | grep "${BLOCKDEV}$" | cut -d\ -f9)"
|
|
|
|
DEVICE_ID="$(ls -l --color=never /dev/disk/by-id | sed 's/ \+/ /g' | grep -v 'nvme-eui\|wwn-' | grep "${BLOCKDEV}$" | cut -d\ -f9)"
|
|
|
|
DEV_BYTES="$(lsblk -bnPo NAME,SIZE | grep "\"${BLOCKDEV}\"" | cut -d\" -f 4)"
|
|
|
|
DEV_BYTES="$(lsblk -bnPo NAME,SIZE | grep "\"${BLOCKDEV}\"" | cut -d\" -f 4)"
|
|
|
|
if [ "${DEV_BYTES}" -ge $((10**16)) ]; then
|
|
|
|
if [ "${DEV_BYTES}" -ge $((1000**5)) ]; then
|
|
|
|
DEVICE_SZ="$((DEV_BYTES/1000**5))P"
|
|
|
|
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^5}" | cut -b1-5)T"
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((10**13)) ]; then
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((1000**4)) ]; then
|
|
|
|
DEVICE_SZ="$((DEV_BYTES/1000**4))T"
|
|
|
|
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^4}" | cut -b1-5)T"
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((10**10)) ]; then
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((1000**3)) ]; then
|
|
|
|
DEVICE_SZ="$((DEV_BYTES/1000**3))G"
|
|
|
|
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^3}" | cut -b1-5)G"
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((10**7)) ]; then
|
|
|
|
elif [ "${DEV_BYTES}" -ge $((1000**2)) ]; then
|
|
|
|
DEVICE_SZ="$((DEV_BYTES/1000**2))M"
|
|
|
|
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^2}" | cut -b1-5)M"
|
|
|
|
elif [ "${DEV_BYTES}" -ge 10000 ]; then
|
|
|
|
elif [ "${DEV_BYTES}" -ge 1000 ]; then
|
|
|
|
DEVICE_SZ="$((DEV_BYTES/1000))K"
|
|
|
|
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000}" | cut -b1-5)K"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
DEVICE_SZ="${DEV_BYTES}B"
|
|
|
|
DEVICE_SZ="${DEV_BYTES}B"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|