Pcornel
Linux

Disks & Block Devices

Cheat sheet · https://pcornel.dk/topic.php?topic=2747

Back to the Topic

Answer

Disks and block devices are the storage the kernel presents as /dev/sdX, /dev/nvmeXnY, /dev/vdX, with partitions, RAID, LVM and encryption layered on top before a filesystem.

Remember

Identify disks by serial or WWN (/dev/disk/by-id), not by sdX order. Map the full stack with lsblk before changing anything. New disks in VMs may need a rescan (echo 1 > /sys/class/scsi_device/*/device/rescan or rescan-scsi-bus).

First checks

  • lsblk -f — disks, partitions, filesystems, UUIDs and mount points
  • blkid — UUIDs, labels and types
  • fdisk -l / parted -l — partition tables
  • udevadm info /dev/<dev> — device properties

Commands

lsblk
Display block-device topology, sizes, types, mount relationships and selected device attributes.
blkid
Read block-device signatures such as filesystem type, UUID and label.
fdisk
Inspect or edit disk partition tables using a sector-oriented partitioning interface.
parted
Inspect or edit partition tables and partition boundaries with scriptable size units.
findmnt
df -hT
smartctl -a

Verify in this order

disk detected → block device → partition table → RAID/LVM/crypt layers → filesystem → mount

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2747

Confirmation

Confirm action

Continue?