Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux use hdparm and dd commands to detect hard drives

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "Linux how to use hdparm and dd commands to detect hard disk", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "Linux how to use hdparm and dd commands to detect hard disk" this article.

After the Linux server has installed the system, it wants to know whether the read and write of the hard disk can meet the needs of the service. If it does not meet the IO of the hard disk, it is a bottleneck of the service.

How to use the hdparm command to detect the transfer speed of a hard disk

Log in with root administrator privileges and execute the command:

$sudo hdparm-tT / dev/sda

Or

$sudo hdparm-tT / dev/hda

Output:

/ dev/sda:Timing cached reads: 7864 MB in 2.00 seconds = 3935.41 MB/secTiming buffered disk reads: 204 MB in 3.00 seconds = 67.98 MB/sec

For more accurate detection, this operation should be repeated 2-3 times. This shows the speed at which you can read directly from the Linux buffer cache without accessing the disk. This measurement is actually an indicator of the throughput of the processor, cache, and memory of the system under test. This is an example of a for loop that runs the test three times in a row:

For i in 1 23; do hdparm-tT / dev/hda; done

Here,

-t: execute device read sequence-T: execute cache read time / dev/sda: hard disk device file

To find out the connection speed of the SATA hard drive, enter:

Sudo hdparm-I / dev/sda | grep-I speed

Output:

* Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Gen3 signaling speed (6.0Gb/s)

The above output shows that my hard drive can use the speed of 1.5Gb/s, 3.0Gb/s or 6.0Gb/s. Please note that your BIOS/ motherboard must support SATA-II/III:

$dmesg | grep-I sata | grep 'link up'dd command

You can also get the corresponding speed information using the dd command:

Dd if=/dev/zero of=/tmp/output.img bs=8k count=256krm / tmp/output.img

Output:

262144500 records in262144+0 records out2147483648 bytes (2.1 GB) copied, 23.6472 seconds, `90.8 MB/ s`

The following are the recommended dd command parameters:

Dd if=/dev/input.file of=/path/to/output.file bs=block-size count=number-of-blocks oflag=dsync## GNU dd syntax # # dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync## OR alternate syntax for GNU/dd # # dd if=/dev/zero of=/tmp/testALT.img bs=1G count=1 conv=fdatasync

This is the output of the third command from the above command:

1: 0 records in1+0 records out1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.23889 s, 253 MB/s

"disk and Storage"-GUI tool

You can also use the disk utility located on the system > Administration > disk Utilities menu. Note that in the latest version of Gnome, it is referred to simply as "disk".

How can I use the disk on Linux to test the performance of my hard drive?

To test the speed of the hard drive:

From the activity Overview, open disk (press super on the keyboard and type "disks") Select the disk selection menu button from the list in the left pane and select Test disk performance from the menu. Click "start performance testing." And adjust the transmission rate and access time parameters as needed. Select start performance Test to test the speed at which data is read from disk. If you need administrative privileges, please enter your password.

Read-only Benchmark (in safe mode)

Then, select > read-only:

The above options do not destroy any data.

Benchmark for reading and writing (all data will be lost, so be careful)

Access the system > Administration > disk Utility menu > Click performance Test > Click the start read / write performance Test button:

The above is all the contents of the article "how Linux uses hdparm and dd commands to detect hard drives". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report