When using linux systems, there sometimes is a need to understand the exact disk properties. One reason is to be able to understand IO read and write size, and how it affects latency.
Linux uses buffered IO by default. That means that any read or write request will use the cache. The cache in linux is completely automatic, essentially consisting of non-allocated memory. However, in most cases buffered IO will also require memory when there is memory shortage.
To understand which block device a filesystem is using, use the
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 39.1G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 38.1G 0 part ├─almalinux-root 253:0 0 36G 0 lvm / └─almalinux-swap 253:1 0 2.1G 0 lvm [SWAP]
In this case the
lsblk command tells me I got one disk (sda), with two partitions (sda1 and sda2). The disk here therefore is
The disk exposes a lot of its properties via
/sys/block/<DISK>/queue, such as:
- The disk maximum IO size:
- The disk current maximum IO size:
- The disk IO queue size:
- The disk read-ahead size:
- The scheduler for the disk:
- Is the disk (set as/considered) to be on a rotating disk: `rotational' (readonly).
- Is the disk (set as/considered) to be on dax (writeable persistent memory):
Read-write and readonly:
- 'read-write' means it's a setting that can be manipulated.
- 'readonly' means it's a property read by the driver from the underlying "hardware".