iotop 但對於特定磁碟?

iotop 但對於特定磁碟?

iotop有沒有類似但用於監視特定磁碟區上的 IO 的工具? (或者也許我錯過了一種過濾方法iotop?)如果沒有,有什麼方法可以透過(比如說)來獲取這些資訊/proc? (dstat等僅顯示每卷所有進程的聚合活動,而我有興趣了解每個進程貢獻了多少。)

答案1

這不是一個理想的答案,但這會告訴您,每一秒,哪個進程寫入最多,以及寫入給定磁碟的數量(在本例中/dev/sda):

dstat -tdD /dev/sda --top-io

你會看到類似的東西:

數據統計輸出

答案2

查看fatrace:

例如,cd 進入您想要/hdd監視的分割區(在我的例子中是掛載點)並執行

sudo fatrace -c -t

然後,例如 atouch /hdd/x將顯示:

16:11:05.278541 touch(179482): + /hdd
16:11:05.278541 touch(179482): CWO /hdd/x

細節:

Usage: fatrace [options...] 

Options:
  -c, --current-mount       Only record events on partition/mount of current directory.
  -o FILE, --output=FILE    Write events to a file instead of standard output.
  -s SECONDS, --seconds=SECONDS Stop after the given number of seconds.
  -t, --timestamp       Add timestamp to events. Give twice for seconds since the epoch.
  -p PID, --ignore-pid PID  Ignore events for this process ID. Can be specified multiple times.
  -f TYPES, --filter=TYPES  Show only the given event types; choose from C, R, O, or W, e. g. --filter=OC.
  -C COMM, --command=COMM   Show only events for this command.
  -h, --help            Show help.

答案3

因為還沒有答案...

我沒有一個簡單的建議(例如iotop 開關),但如果這對您很重要,那麼您可以編寫一個FUSE 模組,該模組僅在其他地方重新安裝檔案系統(對要檢查的進程進行chroot)併計算讀取取的資料量/ 寫的。這應該是對現有模組的相當簡單的改編。您可以詢問 FUSE 社區,哪一個可能是最好的現有解決方案。也許他們的演示模組也可以。

答案4

您可以使用 iostat 來監視磁碟 I/O 的效能問題。

$ iostat -xd /proc

相關內容