I want to check what is the disk queue length of a physical hard drive, on which a specified folder is stored e.g. /home/andy250/myfiles
I want to check this automatically via script.
I am running Azure Linux VM (Ubuntu 20.04). Running df /home/andy250/myfiles
gives me this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 30309264 16460592 13832288 55% /
And then when I run iostat -x
I get this
avg-cpu: %user %nice %system %iowait %steal %idle
0.82 0.01 0.39 0.07 0.00 98.70
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
loop0 0.01 0.37 0.00 0.00 0.18 41.25 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop1 0.02 0.83 0.00 0.00 0.42 51.09 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop10 0.05 1.48 0.00 0.00 0.06 29.10 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop11 0.00 0.03 0.00 0.00 0.27 21.31 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop12 0.01 0.36 0.00 0.00 0.07 62.18 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop13 0.05 2.16 0.00 0.00 0.24 45.46 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop14 0.02 0.72 0.00 0.00 0.05 38.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
loop15 0.00 0.02 0.00 0.00 0.10 18.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop16 0.02 0.74 0.00 0.00 0.03 38.20 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
loop17 0.05 1.44 0.00 0.00 0.04 27.94 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop2 0.03 0.39 0.00 0.00 0.10 12.35 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop3 0.00 0.00 0.00 0.00 0.20 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop4 0.04 0.50 0.00 0.00 0.07 13.31 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop5 0.04 0.47 0.00 0.00 0.07 12.60 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop6 0.07 1.05 0.00 0.00 0.08 14.19 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
loop7 0.06 1.50 0.00 0.00 0.11 25.58 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
loop8 0.09 0.28 0.00 0.00 0.04 2.97 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
loop9 0.01 0.33 0.00 0.00 0.11 37.36 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 1.02 26.82 0.08 7.04 0.85 26.31 1.31 45.36 0.98 42.76 14.55 34.66 0.11 59.70 0.00 0.49 10.11 561.47 0.02 0.32
sdb 0.00 0.02 0.00 0.00 0.29 29.83 0.00 0.54 0.00 60.32 3.06 479.99 0.00 54.03 0.00 50.00 0.07 242163.65 0.00 0.00
So the problem is that df
shows a "Filesystem" that does not exist on the list of "Devices" in output of iostat
. I am probably missing some fundamentals on how linux filesystem works, but I want to somehow figure out on which device the folder /home/andy250/myfiles
(Filesystem /dev/root
) physically exists - so I can parse the correct line of iostat
output or just run iostat -dx [device id]
.
EDIT
Output from lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 135.1M 1 loop /snap/chromium/1912
loop2 7:2 0 55.5M 1 loop /snap/core18/2284
loop3 7:3 0 4K 1 loop /snap/bare/5
loop4 7:4 0 61.9M 1 loop /snap/core20/1328
loop5 7:5 0 61.9M 1 loop /snap/core20/1361
loop6 7:6 0 164.8M 1 loop /snap/gnome-3-28-1804/161
loop7 7:7 0 248.8M 1 loop /snap/gnome-3-38-2004/99
loop8 7:8 0 65.2M 1 loop /snap/gtk-common-themes/1519
loop9 7:9 0 43.6M 1 loop /snap/snapd/14978
loop10 7:10 0 346.8M 1 loop /snap/wine-platform-runtime/286
loop11 7:11 0 5.9M 1 loop /snap/notepad-plus-plus/346
loop12 7:12 0 134.8M 1 loop /snap/chromium/1926
loop13 7:13 0 322.9M 1 loop /snap/wine-platform-6-stable/14
loop14 7:14 0 67.2M 1 loop /snap/lxd/21835
loop15 7:15 0 6M 1 loop /snap/notepad-plus-plus/349
loop16 7:16 0 67.9M 1 loop /snap/lxd/22526
loop17 7:17 0 346.9M 1 loop /snap/wine-platform-runtime/287
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 29.9G 0 part /
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 106M 0 part /boot/efi
sdb 8:16 0 16G 0 disk
└─sdb1 8:17 0 16G 0 part /mnt
EDIT 2
Output from ls -al /dev/root
:
brw------- 1 root root 8, 1 Feb 28 08:17 /dev/root
Output from stat "$(realpath /dev/root)"
File: /dev/root
Size: 0 Blocks: 0 IO Block: 4096 block special file
Device: 5h/5d Inode: 160 Links: 1 Device type: 8,1
Access: (0600/brw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-02-28 08:18:15.753244000 +0000
Modify: 2022-02-28 08:17:56.732000000 +0000
Change: 2022-02-28 08:17:56.732000000 +0000
Birth: -