This is highly platform-dependent. Also different methods may treat edge cases differently (“fake” disks of various kinds, RAID volumes, …).
On modern udev installations, there are symbolic links to storage media in subdirectories of /dev/disk
, that let you look up a disk or a partition by serial number (/dev/disk/by-id/
), by UUID (/dev/disk/by-uuid
), by filesystem label (/dev/disk/by-label/
) or by hardware connectivity (/dev/disk/by-path/
).
Under Linux 2.6, each disk and disk-like device has an entry in /sys/block
. Under Linux since the dawn of time, disks and partitions are listed in /proc/partitions
. Alternatively, you can use lshw: lshw -class disk
.
Linux also provides the lsblk
utility which displays a nice tree view of the storage volumes (since util-linux 2.19, not present on embedded devices with BusyBox).
If you have an fdisk
or disklabel
utility, it might be able to tell you what devices it's able to work on.
You will find utility names for many unix variants on the Rosetta Stone for Unix, in particular the “list hardware configuration” and “read a disk label” lines.
Processes do not consume CPU resources while they are sleeping. They may add some overhead since the Kernel has to juggle them around, but that is very insignificant.
However, because of the way the question is worded, I should mention that when using Linux's CFS (Completely Fair Scheduler), it attempts to give programs increased CPU time in proportion to the time it sleeps - that is, if a process sleeps a lot, when it is resumed, it gets a higher priority.
See http://www.ibm.com/developerworks/linux/library/l-completely-fair-scheduler/ for a description of CFS.
Best Answer
Iotop is a good tool for what you want. It also allows one to display the accumulated amount of I/O on any of the DISK READ, DISK WRITE, SWAPIN, and IO (overall percentage). This is through a nifty interface:
Like
top
, the presentation is rather busy. Another thing is that it doesn't have the myriad options thattop
has (e.g. I can't chose to hide any of the columns I'm uninterested in), but the tool is more than good enough for its specific purpose.