linux hdparm_hdparm命令教程和Linux示例

linux hdparm

linux hdparm

Linux have different tools to manage disk devices and hard disks. hdparm is one of the popular tools. Hdparm can get information about hard disk, change writing intervals, acoustic management, DMA settings etc.But be cautious while changing settings about the hard disk drive.

Linux有不同的工具来管理磁盘设备和硬盘。 hdparm是流行的工具之一。 Hdparm可以获取有关硬盘的信息,更改写入间隔,声音管理,DMA设置等,但是在更改硬盘驱动器的设置时请务必谨慎。

句法 (Syntax)

hdparm [options] [device ...]

帮帮我 (Help)

$ hdparm -h
Help
Help
帮帮我

显示有关磁盘的信息(Show Information About Disk)

One of the most wanted feature is getting information about the hard disk drive. We will use -I option and the hard disk drive to get detailed information.

最需要的功能之一是获取有关硬盘驱动器的信息。 我们将使用-I选项和硬盘驱动器来获取详细信息。

$ hdparm -I /dev/sda
Show Information About Disk
Show Information About Disk
显示有关磁盘的信息

We will get a lot of detailed information about the hard disk. Here are some of them

我们将获得许多有关硬盘的详细信息。 这里是其中的一些

  • Model Number

    型号编号
  • Serial Number

    序列号
  • Firmware Revision

    固件修订
  • Cylinders, Heads, Sectors

    气缸,缸盖,扇形
  • DMA

    DMA
  • Features supported and enabled

    支持和启用的功能

测量硬盘设备的读取速度(Measure Hard Disk Device Read Speed)

Hard disk drive speed can be tested with hdparm . We will use -t option for speed test. This test will only look read speed of the hard disk drive.

硬盘驱动器速度可以使用hdparm进行测试。 我们将使用-t选项进行速度测试。 该测试将仅查看硬盘驱动器的读取速度。

$ sudo hdparm -t /dev/vdb
Measure Hard Disk Device Read Speed
Measure Hard Disk Device Read Speed
测量硬盘设备的读取速度

We will get the benchmarks result after 5-10 seconds. We will get information like how much disk read is done and how much time required for this and average read performance in MB/sec

5-10秒后,我们将获得基准测试结果。 我们将获得诸如完成多少磁盘读取以及所需的时间以及平均读取性能(MB /秒)之类的信息。

测量硬盘缓存读取速度 (Measure Hard Disk Cache Read Speed)

Another read hard disk device speed test is reading cache. Reading cache will give more higher performance than reading from disk because only the cached data will be used and tested. We will use -T option for this benchmark test.

另一个读取硬盘设备速度的测试是读取缓存。 与仅从磁盘读取数据相比,读取缓存将提供更高的性能,因为只有缓存的数据将被使用和测试。 我们将在此基准测试中使用-T选项。

$ sudo hdparm -T /dev/vdb
Measure Hard Disk Cache Read Speed
Measure Hard Disk Cache Read Speed
测量硬盘缓存读取速度

As we can see from screenshot that reading performance is at 5GB/sec

从屏幕截图可以看出,读取性能为5GB /秒

启用预读(Enable Read Ahead)

To enable read ahead we will use -A1 .

为了启用-A1读,我们将使用-A1

$ sudo hdparm -A1 /dev/vda

请安静 (Silence Please)

Mechanic disk or classical hard disks have some moving parts. There are disks in the hard disk which turns 5400 or 7200 RPM. There are some heads those will write some data by using magnetic areas techniques which will create some noise. Especially in busy systems this noise can be problem for us. We can lower the noise by lowering disk performance.

机械磁盘或经典硬盘具有一些运动部件。 硬盘中的磁盘转速变为5400或7200 RPM。 有些磁头会使用磁区技术写入一些数据,这会产生一些噪音。 特别是在繁忙的系统中,这种噪声对我们来说可能是个问题。 我们可以通过降低磁盘性能来降低噪音。

$ hdparm -M 128 /dev/sda

更改磁盘写入时间 (Change Disk Write Periods)

Another popular issue is hard disk drives writing periods. We can change write intervals with -B option with the level. Levels can be between  and 255 .

另一个流行的问题是硬盘驱动器的写入时间。 我们可以通过级别的-B选项更改写入间隔。 级别可以介于255

$ hdparm -B 254 /dev/sda

更改DMA设置 (Change DMA Settings)

DMA gives performance to the hard disk operations. Which will write data into disk drive without need of CPU or other mechanisms. New disk drives all ready this featured enabled but for some older disk drives may not have this feature enabled. We can enable DMA with-d1

DMA可提高硬盘操作的性能。 它将不需要CPU或其他机制将数据写入磁盘驱动器。 新的磁盘驱动器都已准备好启用此功能,但对于某些较旧的磁盘驱动器可能未启用此功能。 我们可以使用-d1启用DMA

$ hdparm -d1 /dev/sda
LEARN MORE  What Is A Flash Drive?
了解更多什么是闪存驱动器?

翻译自: https://www.poftut.com/hdparm-command-tutorial-with-examples-for-linux/

linux hdparm

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值