Linucate
~ Linucate_

204.2 Adjusting Storage Device Access

All Levels

Introduction

Storage tuning must begin with the device type and workload. Settings that once mattered for IDE disks may be irrelevant or dangerous for NVMe and virtual storage.

What you should be able to do after this lesson:

  • Recognize Linux storage device naming.
  • Inspect ATA/SATA, SCSI, and NVMe devices.
  • Explain TRIM and choose periodic or online discard behavior.
  • Discover and log in to an iSCSI target.
  • Recognize WWN, WWID, LUN, and common SAN protocols.

Big Idea: Identify the Transport Before Tuning

The same /dev/sdX name may represent a SATA disk, USB device, virtual disk, Fibre Channel LUN, or iSCSI target. Begin with the path and protocol, then choose its tool:

ATA/SATA -> hdparm
SCSI/SAN path -> sdparm and persistent IDs
NVMe -> nvme
iSCSI -> iscsiadm and iscsid
filesystem discard -> fstrim or mount policy

Generic block-device names alone are not enough evidence for a tuning decision.

Device Families

Common names include:

  • /dev/hd* for legacy IDE devices
  • /dev/sd* for SCSI, SATA through the SCSI layer, USB, and many virtual disks
  • /dev/nvme0n1 and /dev/nvme0n1p1 for NVMe namespaces and partitions
  • /dev/mapper/* for device-mapper paths

Prefer persistent links under /dev/disk/by-id/ or filesystem UUIDs in configuration.

ATA and SCSI Inspection

hdparm -I /dev/sda
hdparm -tT /dev/sda
sdparm --all /dev/sda

hdparm can display ATA capabilities and adjust selected parameters. Some write-cache, power, or security operations risk data, so read device documentation and avoid applying historical IDE tuning advice blindly.

Inspect interrupts and kernel state when diagnosing access:

cat /proc/interrupts
dmesg | grep -i -E 'ata|scsi|nvme|error'

SSD and NVMe

nvme list
nvme id-ctrl /dev/nvme0
nvme smart-log /dev/nvme0

TRIM informs storage which blocks are no longer in use:

fstrim -av
systemctl status fstrim.timer

Periodic fstrim is common. The discard mount option sends discards online and may have workload-dependent costs.

iSCSI

iSCSI carries SCSI commands over IP. The client is an initiator and the storage system presents targets and LUNs.

iscsiadm -m discovery -t sendtargets -p 192.0.2.20
iscsiadm -m node --login
iscsiadm -m session

Persistent behavior is configured through node records and iscsid. After login, a LUN usually appears as a SCSI block device. Use stable identifiers because /dev/sdX ordering can change.

The daemon configuration is commonly stored in /etc/iscsi/iscsid.conf. scsi_id can help obtain a stable identifier for a SCSI device. Authentication settings, automatic startup, discovery records, and network dependencies must all be protected and tested.

SAN Identifiers

  • WWN: globally unique name associated with storage or a port.
  • WWID: persistent identifier used to recognize a device across paths.
  • LUN: numbered logical unit presented by a storage target.
  • FCoE: Fibre Channel transported over Ethernet.
  • AoE: ATA over Ethernet.

Multipath systems combine multiple routes to the same WWID; never create separate filesystems on paths that represent the same LUN.

Safe Tuning Workflow

  1. Identify protocol, device, firmware, and workload.
  2. Capture latency, throughput, and error baselines.
  3. Verify vendor and kernel support for the setting.
  4. Change one parameter.
  5. Test under representative load and preserve a rollback path.

Guided Practice: Trace a Storage Path

Choose a noncritical device and gather read-only evidence:

lsblk -o NAME,TYPE,TRAN,HCTL,SERIAL,WWN,MODEL
udevadm info --query=property --name=/dev/<device>
readlink -f /dev/disk/by-id/<matching-link>
cat /proc/interrupts

Then use only the matching inspection command:

sudo hdparm -I /dev/<ata-device>
sudo sdparm --all /dev/<scsi-device>
sudo nvme smart-log /dev/<nvme-controller>

Do not copy a modifying option from one protocol to another. Record the transport, stable ID, current scheduler or discard behavior, and observed health before proposing a change.

Troubleshooting Scenario

An iSCSI filesystem fails after reboot even though manual login works. The mount uses /dev/sdc1, and that name now belongs to a local disk.

Stop before mounting or formatting anything. Identify the LUN by WWID, configure the iSCSI session to start at the correct stage, and reference a persistent /dev/disk/by-id/ path or filesystem UUID. Device discovery order is not a persistent identity.

Exam Focus

  • Recognize legacy IDE/ATAPI and DMA concepts without applying obsolete tuning blindly.
  • Know hdparm, sdparm, nvme, tune2fs, fstrim, and relevant sysctl settings.
  • Know iscsiadm, iscsid, iscsid.conf, and scsi_id roles.
  • Distinguish WWN, WWID, LUN, iSCSI, AoE, and FCoE.

Recap

  • Storage naming does not always reveal physical transport.
  • Use protocol-specific tools such as hdparm, sdparm, and nvme.
  • TRIM is about released blocks, not general filesystem repair.
  • iSCSI exposes remote LUNs as local block devices after login.
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.