不知道您是否正在寻找以实时方式或在一段时间内显示此类信息的工具,但是这里有两个工具可以显示正在访问的磁盘的实时情况。
纳米
您可以这样调用它nmon
。然后,一旦打开,则单击j(文件系统),然后单击d(磁盘I / O图D = Stats)。有关h更多详细信息,请参见内置帮助()。
$ nmon
┌nmon─13g─────────────────────Hostname=manny────────Refresh= 2secs ───11:15.32─────────────────────────────────────────────────────┐
│ Filesystems ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│Filesystem SizeMB FreeMB %Used Type MountPoint │
│v/mapper/ubuntu-root 465389.0 457483.9 1.7 ext4 / │
│/proc proc not a real filesystem │
│/sys sysfs not a real filesystem │
│/sys/fs/fuse/connections fusectl not a real filesystem │
│/sys/kernel/debug debugfs not mounted │
│/sys/kernel/security security not a real filesystem │
│/dev devtmpfs not a real filesystem │
│/dev/pts devpts not a real filesystem │
│tmpfs 740.5 739.4 0.1 tmpfs /run │
│none 5.0 5.0 0.0 tmpfs /run/lock │
│none 1851.2 1849.8 0.1 tmpfs /run/shm │
│none 100.0 99.9 0.1 tmpfs /run/user │
│/dev/sda1 910.9 606.5 33.4 ext2 /boot │
│/run/rpc_pipefs rpc_pipe fstatfs returned zero blocks!! │
│/run/user/emma/gvfs fuse.gvf not mounted │
│/run/user/emily/gvfs fuse.gvf not mounted │
│ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates─────────────────────────────────────────────────────│
│DiskName Busy Read WriteMB|0 |25 |50 |75 100| │
│sda 100% 0.0 66.4|RWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW> │
│sda1 0% 0.0 0.0|> | │
│sda2 0% 0.0 0.0|> | │
│sda5 100% 0.0 66.4|RWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW> │
│dm-0 100% 0.0 48.0|RWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW> │
│dm-1 0% 0.0 0.0| > | │
│Totals Read-MB/s=0.0 Writes-MB/s=180.9 Transfers/sec=363.2 │
│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
另一种工具,我已经遇到,做至少磁盘I的实时取景/ O是atop
。
$ atop
ATOP - grinchy 2013/08/23 11:10:58 ------ 10s elapsed
PRC | sys 2.18s | user 26.26s | #proc 315 | #trun 5 | #tslpi 764 | #tslpu 1 | #zombie 0 | #exit 1 |
CPU | sys 22% | user 264% | irq 0% | idle 110% | wait 4% | guest 0% | curf 1.20GHz | curscal 44% |
cpu | sys 5% | user 76% | irq 0% | idle 19% | cpu003 w 0% | guest 0% | curf 1.20GHz | curscal 44% |
cpu | sys 5% | user 67% | irq 0% | idle 26% | cpu001 w 2% | guest 0% | curf 1.20GHz | curscal 44% |
cpu | sys 5% | user 62% | irq 0% | idle 31% | cpu000 w 1% | guest 0% | curf 1.20GHz | curscal 44% |
cpu | sys 7% | user 58% | irq 0% | idle 34% | cpu002 w 1% | guest 0% | curf 1.20GHz | curscal 44% |
CPL | avg1 3.83 | avg5 4.59 | avg15 4.76 | | csw 54101 | intr 45315 | | numcpu 4 |
MEM | tot 7.6G | free 194.3M | cache 495.5M | dirty 2.7M | buff 38.9M | slab 86.7M | | |
SWP | tot 5.7G | free 5.5G | | | | | vmcom 12.4G | vmlim 9.5G |
LVM | nchy-lv_home | busy 11% | read 1 | write 524 | KiB/w 3 | MBr/s 0.00 | MBw/s 0.20 | avio 2.05 ms |
LVM | nchy-lv_root | busy 1% | read 0 | write 7 | KiB/w 4 | MBr/s 0.00 | MBw/s 0.00 | avio 9.00 ms |
DSK | sda | busy 11% | read 1 | write 109 | KiB/w 19 | MBr/s 0.00 | MBw/s 0.20 | avio 10.3 ms |
NET | transport | tcpi 72 | tcpo 118 | udpi 15 | udpo 5 | tcpao 11 | tcppo 0 | tcprs 0 |
NET | network | ipi 87 | ipo 123 | ipfrw 0 | deliv 87 | | icmpi 0 | icmpo 0 |
NET | wlan0 ---- | pcki 88 | pcko 123 | si 34 Kbps | so 19 Kbps | erri 0 | erro 0 | drpo 0 |
PID RUID EUID THR SYSCPU USRCPU VGROW RGROW RDDSK WRDSK ST EXC S CPUNR CPU CMD 1/4
3649 saml saml 34 0.33s 11.98s 0K 1752K 4K 2828K -- - R 2 122% chrome
10399 saml saml 4 0.14s 3.08s 5120K -12.8M 0K 0K -- - S 2 32% chrome
具体来说,这些行显示LVM和DSK活动:
LVM | nchy-lv_home | busy 11% | read 1 | write 524 | KiB/w 3 | MBr/s 0.00 | MBw/s 0.20 | avio 2.05 ms |
LVM | nchy-lv_root | busy 1% | read 0 | write 7 | KiB/w 4 | MBr/s 0.00 | MBw/s 0.00 | avio 9.00 ms |
DSK | sda | busy 11% | read 1 | write 109 | KiB/w 19 | MBr/s 0.00 | MBw/s 0.20 | avio 10.3 ms |
iostat
如果您对一段时间内的数据感兴趣,将其iostat
包装到脚本中可能仍然是您的最佳选择。您可以摆脱利用率输出,以便更轻松地进行处理:
$ iostat -dx /dev/sda 5
Linux 2.6.35.14-106.fc14.x86_64 (grinchy) 08/23/2013 _x86_64_ (4 CPU)
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 1.82 96.60 3.84 20.68 122.26 891.99 41.36 0.46 18.77 7.35 18.01
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 26.20 1.60 24.60 17.60 350.40 14.05 0.31 11.95 8.84 23.16
直接从内核
此代码块(bash)将直接向内核显示已读取的I / O。
OLD=`awk '{print $1}' /sys/block/sda/stat` # First field is number of read I/Os processed
DT=1
for ii in `seq 1 10`
do
sleep $DT
NEW=`awk '{print $1}' /sys/block/sda/stat`
echo $((($NEW-$OLD)/$DT))
OLD=$NEW
done
来源:https : //serverfault.com/a/525248/2518
这些信息也可以从任一有/sys/block/sda/stat
或/proc/diskstats
在情况下,你不能或不想安装任何工具。
参考文献