== How to check a disk's health == ==== SATA Disks ==== To check a SATA Disk (either HDD or SSD) we can use the `smartctl` utility: * Install with: `apt install smartmontools` * `smartctl -a /dev/sdX` to see all the information about the disk * `smartctl -t /dev/sdX` to run a short or long test * `smartctl -X /dev/sdX` to abort a test ==== NVMe disks ==== `smartctl` can work for NVMe disks but cannot run any tests like above. We can use the `nvme` utility to see information about nvme disks. * Install with: `apt install nvme-cli` * `nvme list` shows the nvme disks on the machine * `nvme smart-log /dev/nvmeXnX` shows the SMART information about the disk. More info on the `nvme` utility: [https://nvmexpress.org/open-source-nvme-management-utility-nvme-command-line-interface-nvme-cli/ here] ==== Check disk r/w speed ==== Read speed: `hdparm -tT /dev/sdX` (or `nvmeXnX`) Write speed: `dd if=/dev/zero of=test bs=1G count=1 oflag=direct` (`test` must be on the disk) ==== badblocks ==== We can check for bad blocks through (works with NVMe and SATA): `badblocks -v -o output_file /dev/sdX`