Some of the ways to test the speed of you disk is to run benchmark tools or by performing I/O operation on the disk using standard tools and to infer the overall disk speed based on the time it takes the tool to read or write files onto the disk.
Common tools used for these particular purposes on Linux are hdparm and dd respectively. hdparm might need to be installed first as it's not installed by default in most Linux distribution. It is however normally available in the distribution's default repository and can easily be installed by the distribution's default package manager. dd on the other hand is installed by default and can readily be used. Both are commad-line tools and work for any storage device such as magnetic or solid state drive.
$ sudo apt update && sudo apt install --assume-yes hdparm #Ubuntu and Debian derivatives
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 55.4M 1 loop /snap/core18/1932 loop1 7:1 0 55.4M 1 loop /snap/core18/1944 loop2 7:2 0 217.9M 1 loop /snap/gnome-3-34-1804/60 loop3 7:3 0 219M 1 loop /snap/gnome-3-34-1804/66 loop4 7:4 0 51M 1 loop /snap/snap-store/498 loop5 7:5 0 64.8M 1 loop /snap/gtk-common-themes/1514 loop6 7:6 0 62.1M 1 loop /snap/gtk-common-themes/1506 loop7 7:7 0 31.1M 1 loop /snap/snapd/10492 loop8 7:8 0 51M 1 loop /snap/snap-store/518 loop9 7:9 0 31.1M 1 loop /snap/snapd/10707 sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 513M 0 part /boot/efi └─sda3 8:3 0 19.5G 0 part / sr0 11:0 1 1024M 0 rom
$ sudo hdparm -tT /dev/sda /dev/sda: Timing cached reads: 27522 MB in 2.00 seconds = 13783.98 MB/sec Timing buffered disk reads: 1976 MB in 3.00 seconds = 658.03 MB/sec
$ sudo hdparm -tT --direct /dev/sda /dev/sda: Timing O_DIRECT cached reads: 14996 MB in 2.00 seconds = 7507.46 MB/sec Timing O_DIRECT disk reads: 5724 MB in 3.00 seconds = 1907.99 MB/sec
More options for hdparm:
$ hdparm -h hdparm - get/set hard disk parameters - version v9.58, by Mark Lord. Usage: hdparm [options] [device ...] Options: -a Get/set fs readahead -A Get/set the drive look-ahead flag (0/1) -b Get/set bus state (0 == off, 1 == on, 2 == tristate) -B Set Advanced Power Management setting (1-255) -c Get/set IDE 32-bit IO setting -C Check drive power mode status -d Get/set using_dma flag -D Enable/disable drive defect management -E Set cd/dvd drive speed -f Flush buffer cache for device on exit -F Flush drive write cache -g Display drive geometry -h Display terse usage information -H Read temperature from drive (Hitachi only) -i Display drive identification -I Detailed/current information directly from drive -J Get/set Western DIgital "Idle3" timeout for a WDC "Green" drive (DANGEROUS) -k Get/set keep_settings_over_reset flag (0/1) -K Set drive keep_features_over_reset flag (0/1) -L Set drive doorlock (0/1) (removable harddisks only) -m Get/set multiple sector count -M Get/set acoustic management (0-254, 128: quiet, 254: fast) -n Get/set ignore-write-errors flag (0/1) -N Get/set max visible number of sectors (HPA) (VERY DANGEROUS) -p Set PIO mode on IDE interface chipset (0,1,2,3,4,...) -P Set drive prefetch count -q Change next setting quietly -Q Get/set DMA queue_depth (if supported) -r Get/set device readonly flag (DANGEROUS to set) -R Get/set device write-read-verify flag -s Set power-up in standby flag (0/1) (DANGEROUS) -S Set standby (spindown) timeout -t Perform device read timings -T Perform cache read timings -u Get/set unmaskirq flag (0/1) -U Obsolete -v Use defaults; same as -acdgkmur for IDE drives -V Display program version and exit immediately -w Perform device reset (DANGEROUS) -W Get/set drive write-caching flag (0/1) -x Obsolete -X Set IDE xfer mode (DANGEROUS) -y Put drive in standby mode -Y Put drive to sleep -z Re-read partition table -Z Disable Seagate auto-powersaving mode --dco-freeze Freeze/lock current device configuration until next power cycle --dco-identify Read/dump device configuration identify data --dco-restore Reset device configuration back to factory defaults --dco-setmax Use DCO to set maximum addressable sectors --direct Use O_DIRECT to bypass page cache for timings --drq-hsm-error Crash system with a "stuck DRQ" error (VERY DANGEROUS) --fallocate Create a file without writing data to disk --fibmap Show device extents (and fragmentation) for a file --fwdownload Download firmware file to drive (EXTREMELY DANGEROUS) --fwdownload-mode3 Download firmware using min-size segments (EXTREMELY DANGEROUS) --fwdownload-mode3-max Download firmware using max-size segments (EXTREMELY DANGEROUS) --fwdownload-mode7 Download firmware using a single segment (EXTREMELY DANGEROUS) --fwdownload-modee Download firmware using mode E (min-size segments) (EXTREMELY DANGEROUS) --fwdownload-modee-max Download firmware using mode E (max-size segments) (EXTREMELY DANGEROUS) --idle-immediate Idle drive immediately --idle-unload Idle immediately and unload heads --Iraw filename Write raw binary identify data to the specfied file --Istdin Read identify data from stdin as ASCII hex --Istdout Write identify data to stdout as ASCII hex --make-bad-sector Deliberately corrupt a sector directly on the media (VERY DANGEROUS) --offset use with -t, to begin timings at given offset (in GiB) from start of drive --prefer-ata12 Use 12-byte (instead of 16-byte) SAT commands when possible --read-sector Read and dump (in hex) a sector directly from the media --repair-sector Alias for the --write-sector option (VERY DANGEROUS) --sanitize-antifreeze-lock Block sanitize-freeze-lock command until next power cycle --sanitize-block-erase Start block erase operation --sanitize-crypto-scramble Change the internal encryption keys that used for used data --sanitize-freeze-lock Lock drive's sanitize features until next power cycle --sanitize-overwrite PATTERN Overwrite the internal media with constant PATTERN --sanitize-status Show sanitize status information --security-help Display help for ATA security commands --set-sector-size Change logical sector size of drive --trim-sector-ranges Tell SSD firmware to discard unneeded data sectors: lba:count .. --trim-sector-ranges-stdin Same as above, but reads lba:count pairs from stdin --verbose Display extra diagnostics from some commands --write-sector Repair/overwrite a (possibly bad) sector directly on the media (VERY DANGEROUS)
$ sudo dd if=/dev/zero of=benchmark.img bs=1G count=5 status=progress 5368709120 bytes (5.4 GB, 5.0 GiB) copied, 4 s, 1.2 GB/s 5+0 records in 5+0 records out 5368709120 bytes (5.4 GB, 5.0 GiB) copied, 4.36816 s, 1.2 GB/s
$ rm benchmark.img
More options for dd:
$ dd --help Usage: dd [OPERAND]... or: dd OPTION Copy a file, converting and formatting according to the operands. bs=BYTES read and write up to BYTES bytes at a time (default: 512); overrides ibs and obs cbs=BYTES convert BYTES bytes at a time conv=CONVS convert the file as per the comma separated symbol list count=N copy only N input blocks ibs=BYTES read up to BYTES bytes at a time (default: 512) if=FILE read from FILE instead of stdin iflag=FLAGS read as per the comma separated symbol list obs=BYTES write BYTES bytes at a time (default: 512) of=FILE write to FILE instead of stdout oflag=FLAGS write as per the comma separated symbol list seek=N skip N obs-sized blocks at start of output skip=N skip N ibs-sized blocks at start of input status=LEVEL The LEVEL of information to print to stderr; 'none' suppresses everything but error messages, 'noxfer' suppresses the final transfer statistics, 'progress' shows periodic transfer statistics N and BYTES may be followed by the following multiplicative suffixes: c=1, w=2, b=512, kB=1000, K=1024, MB=1000*1000, M=1024*1024, xM=M, GB=1000*1000*1000, G=1024*1024*1024, and so on for T, P, E, Z, Y. Binary prefixes can be used, too: KiB=K, MiB=M, and so on. Each CONV symbol may be: ascii from EBCDIC to ASCII ebcdic from ASCII to EBCDIC ibm from ASCII to alternate EBCDIC block pad newline-terminated records with spaces to cbs-size unblock replace trailing spaces in cbs-size records with newline lcase change upper case to lower case ucase change lower case to upper case sparse try to seek rather than write all-NUL output blocks swab swap every pair of input bytes sync pad every input block with NULs to ibs-size; when used with block or unblock, pad with spaces rather than NULs excl fail if the output file already exists nocreat do not create the output file notrunc do not truncate the output file noerror continue after read errors fdatasync physically write output file data before finishing fsync likewise, but also write metadata Each FLAG symbol may be: append append mode (makes sense only for output; conv=notrunc suggested) direct use direct I/O for data directory fail unless a directory dsync use synchronized I/O for data sync likewise, but also for metadata fullblock accumulate full blocks of input (iflag only) nonblock use non-blocking I/O noatime do not update access time nocache Request to drop cache. See also oflag=sync noctty do not assign controlling terminal from file nofollow do not follow symlinks count_bytes treat 'count=N' as a byte count (iflag only) skip_bytes treat 'skip=N' as a byte count (iflag only) seek_bytes treat 'seek=N' as a byte count (oflag only) Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying. Options are: --help display this help and exit --version output version information and exit GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/dd> or available locally via: info '(coreutils) dd invocation'
Comment anonymously. Login not required.