Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Disks

Tools to identify disks, read their health and look at their partition tables. Most of them only read; the pages say clearly when a command writes.

Start with lsblk to see what is there, then smartctl to see whether a disk is failing. Before anything else on a disk that matters, make it read-only with blockdev and read Working safely with disks.

ToolFor
lsblk and blkidwhich disks, partitions and file systems there are
smartctlhealth of SATA and NVMe drives
nvmeNVMe drive details and health
hdparmSATA drive identification, ATA password state, read speed
lsscsi and sg_inqdisks behind USB adapters and SAS controllers
blockdevthe kernel’s read-only flag, device sizes
losetupusing a disk image as a disk
parted, gdisk and sgdisk, fdiskpartition tables
gpartedpartitions, in a window
f3fake-capacity USB sticks and cards

The commands use /dev/sdX for a whole disk and /dev/sdX1 for a partition; NVMe drives are /dev/nvme0n1 and /dev/nvme0n1p1.