Lookup disk properties on linux

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 writ…


This content originally appeared on DEV Community and was authored by Frits Hoogland

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 command:

$ 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 sda.

The disk exposes a lot of its properties via /sys/block/<DISK>/queue, such as:

  • The disk maximum IO size: max_hw_sectors_kb (readonly).
  • The disk current maximum IO size: max_sectors_kb (read-write).
  • The disk IO queue size: nr_requests (read-write).
  • The disk read-ahead size: read_ahead_kb (read-write).
  • The scheduler for the disk: scheduler (read-write).
  • 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): dax (readonly).


This content originally appeared on DEV Community and was authored by Frits Hoogland


Print Share Comment Cite Upload Translate Updates
APA

Frits Hoogland | Sciencx (2023-06-05T16:21:51+00:00) Lookup disk properties on linux. Retrieved from https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/

MLA
" » Lookup disk properties on linux." Frits Hoogland | Sciencx - Monday June 5, 2023, https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/
HARVARD
Frits Hoogland | Sciencx Monday June 5, 2023 » Lookup disk properties on linux., viewed ,<https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/>
VANCOUVER
Frits Hoogland | Sciencx - » Lookup disk properties on linux. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/
CHICAGO
" » Lookup disk properties on linux." Frits Hoogland | Sciencx - Accessed . https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/
IEEE
" » Lookup disk properties on linux." Frits Hoogland | Sciencx [Online]. Available: https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/. [Accessed: ]
rf:citation
» Lookup disk properties on linux | Frits Hoogland | Sciencx | https://www.scien.cx/2023/06/05/lookup-disk-properties-on-linux/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.