
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
Linux and Unix Test Disk I/O Performance with DD Command
Do you know how to check the performance of a hard drive like checking the read and write speed on your Linux operating systems? then, this article is for you!! which is basically created to provide you an overview of DD command, which is geared towards better guidance to new users and as an exploration tour for getting started to the Linux world.
What is DD Command?
DD is a command-line utility for Unix and Unix-like operating systems where the primary purpose is to copy a file and converting the format of the data during the process.
How to Test Hard Disk using DD Command?
Open your Linux root terminal and add the following command-
$ sudo dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
Output should be like this-
tp@linux:~$ sudo dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync [sudo] password for tp: 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 11.9635 s, 89.8 MB/s tp@linux:~$
Please note that, 1GB is copied during the test and 89.8 MB/second is served throughout fthe test.
Understanding DD Command
Chunks of DD command should be like this –
if=/dev/zero (if=/dev/input.file) | Indicates the input file that you want to read using the DD command. |
of=/tmp/test1.img(of=/path/to/output.file) | Indicates the output file that you want to write using the DD command |
bs=1G(bs=block-size) | Indicates the size of the block that you want DD to use (here I have used 1 GB as a block) |
count=1 (count=number-of-blocks) | Indicates the number of blocks that you want to use in DD to read the block. |
oflag=dsync (oflag=dsync) | Indicates the synchronization I/O for data. |
conv=fdatasyn | This command tells DD to synchronize. |
Use DD command on Linux to test read speed
Before testing the first flush caches data, use the following command-
$ echo 3 | sudo tee /proc/sys/vm/drop_caches time time dd if=/path/to/bigfile of=/dev/null bs=8k
Run the following command to test the data with cache-
tp@linux:~$ dd if=/dev/zero of=/tmp/laptop.bin bs=1G count=1 oflag=direct 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 11.4265 s, 94.0 MB/s
The above command copies 1.1GB of data and 94.0 MB/s is served for the test.
To deactivate cache, use the following command –
$ sudo hdparm -W0 /dev/sda
The output should be like this –
tp@linux:~$ sudo hdparm -W0 /dev/sda /dev/sda: setting drive write-caching to 0 (off) write-caching = 0 (off)
Run the following command to test the data without cache -
$ dd if=/dev/zero of=/tmp/laptop.bin bs=1G count=1 oflag=direct
The output should be like this –
tp@linux:~$ dd if=/dev/zero of=/tmp/laptop.bin bs=1G count=1 oflag=direct 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 11.5062 s, 93.3 MB/s
The above command copies 1.1GB of data and 93.3 MB/s is served for the test.
Congratulations! Now, you know how to test the disk I/O Performance with DD Command. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!
- Related Articles
- Difference between Linux and Unix
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- Init process on UNIX and Linux systems
- Perl Installation on Unix and Linux Platform
- Convert MM/DD/YY to Unix timestamp in MySQL?
- md5sum Command in Linux with Examples
- Working with Zip Command in Linux
- Top 10 UNIX Command Line Mistakes
- Great tools to check linux disk partitions and usage in linux
- Convert dd/mm/yyyy string to Unix timestamp in MySQL?
- How to get the disk performance using PowerShell?
- How to Calculate Optimal Blocksize to Use With dd in Linux
- Convert XLSX to CSV in Linux with Command Line in Linux
- Downgrading Binary and Package-based Installations on Unix/Linux
- Linux last Command
