To test the disk speed with the dd command, you can use it to write a temporary file and measure the write and read speeds. Here are examples:
Test Write Speed
This command writes a 1GB file to your disk, providing the write speed:
1 | dd if=/dev/zero of=testfile bs=1G count=1 oflag=dsync |
dd if=/dev/zero of=testfile bs=1G count=1 oflag=dsync
- if=/dev/zero uses a source of empty bytes.
- of=testfile specifies the output file.
- bs=1G sets the block size to 1 GB.
- count=1 specifies to write only one block.
- oflag=dsync ensures data is physically written to disk, giving a more accurate speed measurement.
Example output:
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.58025 s, 679 MB/s
Test Read Speed
First, clear the file system cache to avoid caching effects:
1 | sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' |
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
Then, read the file back:
1 | dd if=testfile of=/dev/null bs=1G count=1 |
dd if=testfile of=/dev/null bs=1G count=1
- if=testfile reads from the file you just wrote.
- of=/dev/null discards the output, ensuring only read speed is tested.
Clean Up
After the test, delete the temporary file:
1 | rm testfile |
rm testfile
These commands provide approximate disk speeds, but for more accurate results, dedicated benchmarking tools like fio or hdparm are recommended.
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
340 wordsloading...
Last Post: How to Check Hard Disk Type (NVMe SSD) on Servers/VMs?
Next Post: How AI and Dynamic Pricing Shape Our Everyday Costs