Command referenceLinux / storage
Check the target
before you copy the command.
These are working examples for storage testing, disk health and legacy systems. Check the device names, software version and security assumptions in your own environment before using them.
01 / Storage benchmark
FIO — Flexible I/O Tester
FIO builds controlled I/O workloads for storage devices and files. The useful result is the one whose device, block size, queueing and cache behaviour match the question being asked.
Install
# Ubuntu / Debian
sudo apt update
sudo apt install fio
# RHEL / CentOS / Fedora
sudo dnf install fio
fio --version
Sequentially fill a device
These commands permanently overwrite the target device. Verify the path, unmount every partition and confirm that no required data remains.
# 1 MiB sequential writes across the entire device
sudo fio \
--name=filltest \
--filename=/dev/nvme0n1 \
--rw=write \
--bs=1M \
--direct=1 \
--size=100% \
--numjobs=1
Random-read baseline
sudo fio \
--name=randread \
--filename=/dev/nvme0n1 \
--rw=randread \
--bs=4k \
--direct=1 \
--numjobs=4 \
--time_based \
--runtime=60
Mixed workload
# 70% reads / 30% writes
sudo fio \
--name=mixed \
--filename=/dev/nvme0n1 \
--rw=randrw \
--rwmixread=70 \
--bs=4k \
--direct=1 \
--numjobs=4 \
--time_based \
--runtime=60
--filenameThe device or file under test.
--rwThe I/O pattern: read, write, randread or randwrite.
--bsThe block size used for each operation.
--direct=1Bypasses the operating-system page cache.
--numjobsThe number of parallel workers.
--runtimeThe sustained test duration in seconds.
02 / Disk health
Smartmontools — SMART monitoring
Smartmontools reads health, error and self-test information from supported storage devices. Treat SMART as evidence, not a guarantee: a healthy status does not replace redundancy or backups.
Install
# Ubuntu / Debian
sudo apt update
sudo apt install smartmontools
# RHEL / CentOS / Fedora
sudo dnf install smartmontools
smartctl --version
Inspect a device
# Device identity and SMART support
sudo smartctl -i /dev/sda
# Overall health assessment
sudo smartctl -H /dev/sda
# All SMART attributes
sudo smartctl -A /dev/sda
# Error log and prior self-tests
sudo smartctl -l error /dev/sda
sudo smartctl -l selftest /dev/sda
Run self-tests
# Short test
sudo smartctl -t short /dev/sda
# Extended test
sudo smartctl -t long /dev/sda
# Read the result after the stated completion time
sudo smartctl -l selftest /dev/sda
Enable the monitoring daemon
sudo systemctl enable --now smartd
sudo systemctl status smartd
sudo journalctl -u smartd
Schedule extended tests away from peak workloads, test alert delivery before relying on it, and investigate attribute trends rather than waiting for a binary failure flag.
03 / Compatibility
SSH — scoped legacy algorithms
Modern OpenSSH disables weak algorithms for good reason. Re-enable them only for equipment that cannot be upgraded, only on trusted paths, and only for the specific host that needs them.
Typical negotiation errors
Unable to negotiate with 10.10.201.2 port 22:
no matching key exchange method found.
Their offer: diffie-hellman-group14-sha1
Unable to negotiate with 10.10.201.2 port 22:
no matching host key type found.
Their offer: ssh-rsa
One-time connection
ssh \
-oKexAlgorithms=+diffie-hellman-group14-sha1 \
-oHostKeyAlgorithms=+ssh-rsa \
user@10.10.201.2
Host-specific configuration
# ~/.ssh/config
Host legacy-appliance
HostName 10.10.201.2
User user
KexAlgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
mkdir -p ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config
ssh legacy-appliance
SHA-1-based RSA and old Diffie-Hellman groups have known weaknesses. Never enable them globally. Record the exception, isolate the device and remove the override when the equipment is replaced.