'See Disk Activity In Python
Is there a python command or library that I can call to see if hard drive is being written to or read from?
Like this C# one Detect if hard disk is being accessed or not
Solution 1:[1]
Answered above by Nathan Liang
Monitoring disk read/write activity
The answer is at https://pypi.org/project/psutil/5.2.2/
The call would be based on
import psutil
print(psutil.disk_io_counters(perdisk=False))
giving the output something like this
sdiskio(read_count=719566, write_count=1082197, read_bytes=18626220032, write_bytes=24081764352, read_time=5023392, write_time=63199568, read_merged_count=619166, write_merged_count=812396, busy_time=4523412)
to see busy time is
import psutil
psutil.disk_io_counters(perdisk=False)
print(psutil.disk_io_counters(perdisk=False).busy_time)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
