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.
| Tool | For |
|---|---|
| lsblk and blkid | which disks, partitions and file systems there are |
| smartctl | health of SATA and NVMe drives |
| nvme | NVMe drive details and health |
| hdparm | SATA drive identification, ATA password state, read speed |
| lsscsi and sg_inq | disks behind USB adapters and SAS controllers |
| blockdev | the kernel’s read-only flag, device sizes |
| losetup | using a disk image as a disk |
| parted, gdisk and sgdisk, fdisk | partition tables |
| gparted | partitions, in a window |
| f3 | fake-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.