Use the DD command in Linux to test the read/write speed of USB and SSD hard disks.

Source: Internet
Author: User
Tags arch linux

Use the DD command in Linux to test the read/write speed of USB and SSD hard disks.
Disk Drive Speed

The disk drive speed is measured by the amount of read/write data per unit of time. The DD command is a simple command line tool that can read and write any data block on the disk and measure the read/write speed.

In this article, we will use the DD command to test the reading and writing speed of USB and SSD disks.

The data transmission speed depends not only on the drive disk, but also on the connected interfaces. For example, the maximum transmission speed of the USB 2.0 port is 35 Mbit/s, so if you insert a USB 3.0 drive disk that supports high-speed transmission into the USB 2.0 port, the actual transmission speed is the lower limit of port 2.0.

This is also true for SSD. The SATA ports connected to SSD have different types. The theoretical maximum transmission speed of the SATA 375 port is 3 Gbit/s, and that of the SATA 2.0 port is twice the speed.

Test Method

Mount the drive disk to the directory from the terminal. Then, run the DD command to write a file with a fixed block size and then read the file.

The general syntax format of the DD command is as follows:

  1. Dd if = path/to/input_file of =/path/to/output_file bs = block_size count = number_of_blocks

When writing data to the drive disk, we simply read data from the infinite useless byte source/dev/zero. When reading data from the drive disk, we read the file just now, and sends the output result to useless/dev/null. During the entire operation, the DD command will track the data transmission speed and report the results.

SSD

We use a Samsung Evo 120G SSD. It is very cost-effective. It is very suitable for users who are just using solid state disks. It is also my first solid state disk and one of the most effective solid state disks on the market.

In this experiment, we connected the hard disk to the SATA port 2.0.

Write speed ####

First, let's write the data to the SSD.

  1. $ Dd if =/dev/zero of =./largefile bs = 1 M count = 1024
  2. 1024 + 0 records in
  3. 1024 + 0 records out
  4. 1073741824 bytes (1.1 GB) copied, 4.82364 s, 223 MB/s

The actual size is quite large. You can try to use a smaller size, such as 64 K or even 4 K.

Read Speed

Read this file now. However, you must first clear the memory cache to ensure that the file is indeed read from the drive disk.

Run the following command to clear the memory cache

  1. $ Sudo sh-c "sync & echo 3>/proc/sys/vm/drop_caches"

Read this file now

  1. $ Dd if =./largefile of =/dev/null bs = 4 k
  2. 165118 + 0 records in
  3. 165118 + 0 records out
  4. 676323328 bytes (676 MB) copied, 3.0114 s, 225 MB/s

On the Arch Linux wiki page, there is a full page of information about various SSD read/write speeds provided by different vendors, such as Intel, Samsung, and Sandisk. Click the following url to view related information.

Https://wiki.archlinux.org/index.php/SSD_Benchmarking

USB

In this experiment, we will measure the reading and writing speed of a general USB/Walkman. The drive disks are connected to the standard USB 2.0 port. The first is a 4 GB sony USB drive, followed by a 16 GB strongrong drive.

First, insert the driver disk into the port and mount it to make it readable. Then enter the mounted file directory under the command line.

Sony 4 GB-write

In this experiment, we use the DD command to write a 10000-byte file to the drive disk.

  1. # Dd if =/dev/zero of =./largefile bs = 8 k count = 10000
  2. 10000 + 0 records in
  3. 10000 + 0 records out
  4. 81920000 bytes (82 MB) copied, 11.0626 s, 7.4 MB/s

Therefore, the write speed is about 7.5 Mbit/s. This is a very low number.

Sony 4 GB-read

Read the same file back for testing speed. First, run the following command to clear the memory cache.

  1. $ Sudo sh-c "sync & echo 3>/proc/sys/vm/drop_caches"

Now you can use the DD command to read files.

  1. # Dd if =./largefile of =/dev/null bs = 8 k
  2. 8000 + 0 records in
  3. 8000 + 0 records out
  4. 65536000 bytes (66 MB) copied, 2.65218 s, 24.7 MB/s

The read speed is about 25 Mbit/s, which roughly matches the standard of a cheap USB drive disk.

In theory, the maximum signal transmission rate of USB2.0 is 480 megabits per second, and the minimum signal transmission rate is 60 megabits per second. However, due to various restrictions, the actual transmission rate is approximately 280 megabits/s and between 35 megabits/s. In addition, the actual speed depends on the drive disk quality and other factors.

In the above experiment, the USB drive disk is inserted into the USB port 2.0, and the read speed reaches 24.7 Mbit/s, which is a good read speed. But the write speed is not flattering.

Let's use a 16 GB strongrong drive disk for the same experiment. Although strongrong's USB drive is stable, it is also a cheap brand.

Write speed of stron__16 gb disk
  1. # Dd if =/dev/zero of =./largefile bs = 64 k count = 1000
  2. 1000 + 0 records in
  3. 1000 + 0 records out
  4. 65536000 bytes (66 MB) copied, 8.3834 s, 7.8 MB/s
Reading Speed of stron__16 gb disk
  1. # Sudo sh-c "sync & echo 3>/proc/sys/vm/drop_caches"
  2. # Dd if =./largefile of =/dev/null bs = 8 k
  3. 8000 + 0 records in
  4. 8000 + 0 records out
  5. 65536000 bytes (66 MB) copied, 2.90366 s, 22.6 MB/s

It reads at a lower speed than Sony does.

References
  • Http://en.wikipedia.org/wiki/USB
  • Https://wiki.archlinux.org/index.php/SSD_Benchmarking

About Silver Moon

Php developers, bloggers and Linux enthusiasts. can contact him through m00n.silv3r@gmail.com or Google +.

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.