Pcornel
Linux · Disks & Block Devices

Block Devices

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

Back to the Topic

Answer

A block device is a device the kernel reads and writes in blocks: whole disks, partitions, RAID arrays (md), LVM logical volumes (dm), loop devices and encrypted volumes.

Remember

lsblk shows the tree of layers (disk → part → lvm/crypt/raid). A busy device cannot be repartitioned or removed — find what uses it with lsblk, findmnt and pvs.

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 -d -o NAME,ROTA
lsblk -t
lsblk --discard
lsblk -o NAME,RO

Verify in this order

physical disk → partition → optional md/dm layers → block device used by a filesystem or LVM

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=2748

Confirmation

Confirm action

Continue?