как-то так:
DISK=(/dev/nvme0n1 /dev/loop0)
TIME=2
while :; do
i=$(iostat -dsxy $TIME 1 -o JSON ${DISK[*]} | jq -r '.sysstat.hosts[].statistics[].disk[] | "\(.disk_device)\t\(.util) %"')
clear
echo -n -e "$i\n"
done
диски и время ставим свои
вывод:
loop0 0.35 %
nvme0n1 0.42 %
p.s.
но на сколько я могу судить значение
util утилиты
iostat подойдёт разве что для жестких дисков, если исходить из описания
%util
Percentage of elapsed time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100% for devices serving requests serially. But for devices serving requests in parallel, such as RAID arrays and modern SSDs, this number does not reflect their performance limits.