Hard disk performance is tested to diagnose issues, optimistic performance, and reliability of the disk.
It helps the user to detect if any problem is causing the system’s performance. There are a variety of ways in Linux to check the hard disk performance, such as “hdparm”, “dd”, “iostat,” or “Disks” tools.
This post will demonstrate the methods for checking the hard disk performance in Linux.
- Method 1: Through “hdparm” Utility
- Method 2: Through “dd” Utility
- Method 3: Through “iostat” Utility
- Method 4: Through “Disks” (GUI)
Method 1: Through the “hdparm” Utility
The “hdparm” is the abbreviation of Hard Disk Parameter, it is the command line examined to manage the disk services in Linux. Install “hdparm” by running the following command:
$ sudo apt install hdparm #For Debian/Ubuntu $ sudo yum install hdparm #For Fedora/CentOS/RHEL
To measure the read speed of the hard disk, the following command is considered:
$ sudo hdparm -Tt /dev/sda
The command is described as:
- The “hdparm” with sudo permission.
- “T” option to read the buffer cache and “t” flag to test it.
- “/dev/sda” is the hard disk name.
The cache read speed of the hard disk is “5958.31 MB/sec”, and the read speed for the buffer is “391.78 MB/sec”.
Note: The sudo permission is required for the “hdparm” command
Method 2: Through the “dd” Utility
The “dd” is the built-in utility of Linux that enables the user to copy and convert files or the raw data from one source to another. It can be helpful for testing and measuring the speed of the hard disk by copying some raw data. The following command tests the read and writes speed of the hard disk:
$ dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output
The command is described as
- “dd” command to copy the raw data.
- “if=/dev/zero” to read null characters from the special file “/dev/zero”.
- “of=/tmp/output” to copy the null characters in the “output” file.
- “bs=8k” tells each block size of 8KB.
- “count =10k” defining the number of blocks to write.
- “rm -f /tmp/output” command removing the file after testing.
The copy speed of the hard disk is “190 MB/s” which is considered a good performance.
A standard hard disk (HDD) has a read and write speed between 80MB/s to 160MB/s. While the solid state disk (SSD) has a speed between 200MB/s to 500MB/s
Method 3: Through the “iostat” Utility
The “iostat” is a utility of Linux to monitor the performance of the hard disk that comes with the installation of “sysstat.” To install “sysstat” the following command is used:
$ sudo apt install sysstat #For Debian/Ubuntu $ sudo yum install sysstat #For Fedora/CentOS/RHEL
To check the performance of the disk, run the “iostat” with “y” flag for displaying the extended statistics of the device utilization:
$ iostat -y
The number of Kilobytes of read and write per second for each device is printed.
Note: The “dnf” support can be obtained on CentOS via the command:
$ sudo yum install dnf
Method 4: Through the “Disks” (GUI)
Another method to check the performance of the hard disk is to use the “gnome-disks” tool of Linux. Using this, the user can test the benchmark of the hard disk. To install it in the Linux operations system, consider the following command:
$ sudo apt install gnome-disk-utility #For Debian/Ubuntu $ sudo dnf install gnome-disk-utility #For Fedora/CentOS/RHEL $ sudo pacman -s gnome-disk-utility #For Arch
Note: if you are not able to install “genome-disk-utility” on CentOS, install the “dnf” support:
$ sudo yum install dnf
Go through the following steps to do a benchmark of the hard disk.
Step 1: Launch the “gnome-disks”
Search for the “disks” tool from the software and launch it:
Step 2: Choose the Benchmark Option
Click on the 3 dots from the top right side and click on the “benchmark” option:
Step 3: Start the Benchmark
From the given interface, click on the “Start Benchmark” option:
Give the number of samples and size of each sample in MB as per your choice and start the benchmarking:
The benchmarking process is started and will take some time to complete it.
Verify the Results
Once the benchmark is completed, the user can see the result of read/write speed result:
The average read rate is 361.8MB/s.
To check the hard disk performance of the Linux system, the user can consider the utilities such as “hdparm”, “dd ”, or “iostat”. The “Disks” tool can also be used to check the performance of the hard disk. This write-up has illustrated the various ways to check the hard disk performance.