Use_hdparm_to_improve_IDE_device_performance

http://gentoo-wiki.com/HOWTO_Use_hdparm_to_improve_IDE_device_performance

Introduction
Hdparm is a tool that allows you to set IDE device settings. This includes things such as DMA modes, transfer settings and various other settings that can help improve the speed of your hard disks and CDROMs. These settings are not enabled by default, so you will probably want to enable them. This guide is also intended to provide more up-to-date information on hdparm settings and inform the user how to check what settings are supported so that the optimum settings for the drive can be used. Many hdparm guides simply tell people to enable specific modes such as '-X33' or '-c1', and as most of these guides are now out-of-date many people end up using those older settings when better, newer options may now be used. By speeding up your hard drives you should get a faster system. It should also help solve stuttering DVD playback or extremely slow burning.

[edit]Installing hdparm
Firstly check if hdparm is already installed on your system by typing the following as root:

emerge -n hdparm
[edit]Getting information about your different drives
Different drives have different capabilities, so in order to configure them you must know what they are capable of doing. # hdparm -i /dev/hdX should give you the information you need (replace hdX with your drive)

Udev systems also allow for drives to be accessed with a slightly more understandable filename.

For hard drives (replace X with the disc number): hdparm -i /dev/discs/disc#/disc, and for CDROMs: hdparm -i /dev/cdroms/cdrom#/cdrom

You should get something similar to the following

Code: hdparm -i /dev/hdd

Model=WDC WD80EB-28CGH2, FwRev=24.84G24, SerialNo=WD-WMA9N7936819
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=15509/16/63, TrkSize=57600, SectSize=600, ECCbytes=40
BuffType=DualPortCache, BuffSize=768kB, MaxMultSect=16, MultSect=16
CurCHS=15509/16/63, CurSects=15633072, LBA=yes, LBAsects=15633072
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5
AdvancedPM=no WriteCache=enabled
Drive conforms to: device does not report version:

* signifies the current active mode

You will want to repeat this process for each IDE HDD/CDROM you have. Pay attention to the MaxMultSec and maximum mode available from the PIO/DMA/UDMA modes.

[edit]Benchmarking devices
hdparm includes a handy benchmark mode, which should allow you to see how much of a speed improvement each of the different settings gives you. When running a benchmark it is recommended that you close all programs that could interfere with the results. Ideally do it from the console, rather than in a xterm with xorg running. To perform a benchmark, issue a command like the following - once again replacing X with your drive letter:

# hdparm -tT /dev/hdX
You should then get some speed results like the following:

Code: hdparm -tT /dev/hdX
/dev/hdd:
Timing cached reads: 496 MB in 2.00 seconds = 247.42 MB/sec
Timing buffered disk reads: 60 MB in 3.03 seconds = 19.81 MB/sec

It is recommended that you benchmark all your drives and save the results before you start tweaking them, so that you can tell how much of an improvement you are getting.

For example, the following test was run on a hard drive supporting UDMA6:

Code: hdparm -tT /dev/hdX
/dev/hda:
Timing cached reads: 1104 MB in 2.00 seconds = 551.53 MB/sec
Timing buffered disk reads: 170 MB in 3.00 seconds = 56.58 MB/sec

Here's a hard drive set to low, slow settings:

Code: # hdparm -cuda /dev/hda
/dev/hda:
IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
readahead = 256 (on)

And here is its performance information:

Code: # hdparm -tT /dev/hda
/dev/hda:
Timing cached reads: 344 MB in 2.08 seconds = 165.37 MB/sec
Timing buffered disk reads: 10 MB in 3.48 seconds = 2.87 MB/sec

This is the same hard drive, after rebuilding the kernel with the Cotroller's drivers and DMA enabled (see below: "I get "Operation not permitted" errors on setting DMA (-d1)"):

Code: # hdparm -cuda /dev/hda
/dev/hda:
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on)
readahead = 256 (on)

And this is the performance statistics for those settings:

Code: # hdparm -tT /dev/hda
/dev/hda:
Timing cached reads: 464 MB in 2.01 seconds = 231.06 MB/sec
Timing buffered disk reads: 54 MB in 3.06 seconds = 17.65 MB/sec
Note: The IDE Controller in this system doesn't support higher udma levels than udma4, so with a newer controller and udma6 you will probably get better improvements.
[edit]Changing device settings
Warning: Changing settings could possibly damage your hardware or make your system unstable. Most newer drives should cope fine but do so at your own risk!

Note: These setting will be removed upon a system reboot. After you have found the optimal settings for your hard drive, you must follow the instructions below to make them load at bootup.
[edit]Checking current settings
Some settings can be checked by omitting the number used to set it. For instance to check the current DMA mode setting:

# hdparm -d /dev/hda
Some setting however will not work, such as the xfer mode (-X) will set the xfer mode to 0 rather than giving you the current setting or like write-caching (-W) will ask you to give the setting. You can generally find out all the setting on a current drive with a simple

# hdparm /dev/hda
This should give you something similar to the following:

Code: hdparm /dev/hda
/dev/hda:
multcount = 16 (on)
IO_support = 3 (32-bit w/sync)
unmaskirq = 1 (on)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 15509/16/63, sectors = 8004132864, start = 0

Or use a hdparm -i as described above for more advanced settings such as transfer mode.

[edit]DMA mode -d
Changing DMA modes can sometimes cause some older systems to lockup, you have been warned!

The first mode you will probably want to enable is DMA. DMA is important to enable, you will want to enable DMA on DVD drives if you want to watch or burn DVD's, without turning on DMA your DVD playback is likely to stutter and burning can take over an hour rather than a few minutes and has a much higher chance of failing. Enabling DMA on normal cdroms or hard drives is also highly recommended, it should improve speeds a great deal and reduce cpu load. You must also have the DMA option for your chipset compiled in your kernel, it should appear under "Device Drivers>ATA/ATAPI/MFM/RRL support", then select the specific option for your chipset. You can use the following command to check what your IDE chipset is:

# lspci |grep -i ide
To enable DMA on a device type the following:

# hdparm -d1 /dev/hda
Now run a benchmark and see how much of an improvement you have received.

[edit]Xfer mode (PIO/SDMA/MDMA/UDMA) -X
DMA actually has several different possible xfer modes. These are PIO 1-4 (Programmed IO), SDMA 0-2 (Single-word DMA), MDMA 0-2 (Multi-word DMA) and UDMA 0-5 (Ultra-DMA). These modes are set with the following command, replace ## with the desired mode and hda with your drive:

# hdparm -X## /dev/hda
Generally the higher the mode, the better. Here is a list of different xfer modes and their corresponding number:

0 1 2 3 4 5 6
PIO 08 09 10 11 12
SDMA 16 17 18
MDMA 32 33 34
UDMA 64 65 66 67 68 69 70

E.g. To set UDMA6:

# hdparm -X70 /dev/hda
You can also select the desired mode by specifing the name of the mode:

# hdparm -X udma6 /dev/hda
For most modern hard drives you will probaly want to use a UDMA mode. After enabling a xfer mode run a hdparm -i to ensure that the mode has actually been set. Once you have set the desired mode try another benchmark.

Note: hdparm man-page claims that the best mode is set by the drive itself on startup. My own tests have the same result. I only got worse performance by fiddling around with this parameter.
[edit]32-bit IO_SUPPORT -c
You can set 32-bit IO support with the -c# flag. There are 4 different levels of IO_Support

0 default 16-bit
1 32-bit
2 16-bit
3 32-bit w/sync

If possible you will probably want option 1. However, some chipsets do support 32 bit I/O, but have compatibility problems. These chipsets need the sync option, which slows things down a tiny bit. They should use option 3. Only if you experience problems with both options 1 and 3, use option 0 or 2. Most (but not all) newer chipsets work fine with option 1. Here is how you can enable 32 bit I/O on your chipset.

# hdparm -c1 /dev/hda
This setting changes how the data is moved from the PCI bus to the controller. It can double your throughput.

[edit]MultSect -m
When you did hdparm -i on your drive you should have a section MaxMultSect. You can set you MultSect to this with the -m flag shown in the following command, replace # with your MaxMultSect:

# hdparm -m# /dev/hda
This controls how many sectors are fetched from the disk in a single I/O interrupt. Most newer drives should be able to handle a MultSect of 16, or 8 for older ones. Changing this setting should reduce system resources from disk access and also increase disk bandwidth. Note that this is only relevant for PIO modes, and not for DMA modes, where high numbers of sectors are always used, up to 256 on older drives, and up to 65535 on newer drives. The vast majority of drives in use today will be set by the kernel to use a (U)DMA mode by default, making this option irrelevant.

[edit]unmaskirq -u
You can enable unmaskirq with the following:

# hdparm -u1 /dev/hda
Enabling unmasking lets Linux unmask other interrupts while handling a disk interrupt, allowing your system to do other similar tasks at the same time and should improve overall system response time.

[edit]Spindown -S
This Option controls the Spindown of your drive.

# hdparm -Sx /dev/hda
The Time (in seconds) after which the Drive spins down is the value of your x multiplied with 5 From the manpage:

A value of zero means "timeouts are disabled": the device will not automatically enter standby mode.
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.
Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours.
A value of 252 signifies a timeout of 21 minutes.
A value of 253 sets a vendor-defined timeout period between 8 and 12 hours.
A value of 255 is interpreted as 21 minutes plus 15 seconds.
The value 254 is reserved.
Note that some older drives may have very different interpretations of these values.
Example:

hdparm -S12 /dev/hda
Now the drive spins down after 1 minute. (12x5=60s) To turn it off choose x=0.

[edit]Acoustic Management -M
# hdparm -Mx /dev/hda
128 is the quiet-modus. If you set x to 254 you will get the maximum of speed, but you can also choose a number between.

[edit]Power Management -B
This Option controls the Power Management of your drive.

# hdparm -Bx /dev/hda
Set x to 1 to get the maximum powersave or set x to 255 to turn off the Power Management.You can also choose a number between.

[edit]Write-Caching -W
Write-caching can be enabled with the following:

# hdparm -W1 /dev/hda
Write-Caching has been reported to have problems with journaling filesystems (For instance ext3 and Reiser), and it is recommended that you don't enable it on such systems.

[edit]Read-lookahead -A
Read-lookahead can be enabled with the following:

# hdparm -A1 /dev/hda
[edit]Readahead -a
The readahead fs setting can be changed with:

# hdparm -a# /dev/hda
My hard drives have 256 already automatically set.

[edit]Making the hdparm options permanent
Now that you have worked out your ideal hdparm option, you need to edit the /etc/conf.d/hdparm file to ensure that the setting are reloaded next time your system is rebooted.

You should be presented the following file:

File: /etc/conf.d/hdparm (default)
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.2 2004/09/06 02:17:08 swegener Exp $

# You can either set hdparm arguments for each drive using hdX_args,
# discX_args, cdromX_args and genericX_args, e.g.
#
# hda_args="-d1"
# disc1_args="-d1"
# cdrom0_args="-d1"

# or, you can set hdparm options for ALL drives using all_args, e.g.
#
# all_args="-d1"

If most of your drives will be using the same setting, modify the all_args line to reflect your desired hdparm settings. Here is an example file, hda and hdb are standard hard drives that support UDMA-5, hdc only supports UDMA-2 and hdd is a cdrom with readahead of 8 and only supporting UDMA-0, as its a basic cdrom no write caching is needed.

File: /etc/conf.d/hdparm (Sample)
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.2 2004/09/06 02:17:08 swegener Exp $

# You can either set hdparm arguments for each drive using hdX_args,
# discX_args, cdromX_args and genericX_args, e.g.
#
# hda_args="-d1"
# disc1_args="-d1"
# cdrom0_args="-d1"

# or, you can set hdparm options for ALL drives using all_args, e.g.
#
#all_args="-d1"
hda_args="-A1 -d1 -u1 -c3 -X69 -W1 -m16"
hdb_args="$hda_args"
hdc_args="-A1 -d1 -u1 -c3 -X66 -W1 -m16"
hdd_args="-A1 -d1 -u1 -c3 -X64 -m16 -a8"

Lastly, add hdparm to be run at boot:

# rc-update add hdparm boot
[edit]Troubleshooting
[edit]hdparm -i shows a UDMA mode however nothing happens when i try and set that mode
This is most likely because your mother board doesn't support the higher ATA modes required to run this mode. If you are sure that your mother board supports the mode make sure that the device is attached to the correct IDE plug on the mother board. Different ATA specifications have different coloured sockets on the motherboard.

Here is a list of the different UDMA modes and the ATA requirement:

UDMA ATA
0 ATA 16
1 ATA 24
2 ATA 33
3 ATA 44
4 ATA 66
5 ATA 100
6 ATA 133
[edit]I get "Operation not supported" errors on even basic commands such as 'hdparm -i'
You are probaly attempting to use hdparm on a SATA or some other bizarre drive. hdparm currently has very limited support for SATA drives however these drives are generally setup automatically to use most of the more decent settings. You should be able to get the basic information (without the -i) and benchmarking to work. Try benchmarking the drive to check if you are getting good speeds (generally above 1000MB for cached reads and above 50MB for buffered reads).

blktool is an alternatative to hdparm with some support for SATA and SCSI drives.

[edit]I get "Operation not permitted" errors on setting DMA (-d1)
Your kernel is not supporting these IDE instructions. After compiling the kernel with all settings right, the same error returns, and this is a bug / sloppy hardware problem (my experience). You might want to try to compile your IDE chipset extension into the kernel, NOT AS A MODULE. That way this code loads before IDE_GENERIC and the problem is gone.

If the latter is not helpful, check your BIOS settings. For example, using ASUS's "enhanced IDE" mode which is labeled as native to Win2K/XP will cause your system to come to a crawl. There may be several other BIOS settings for your drive that will cause performance problems. If you have BIOS options available for your drive, make sure they look right to you before you endeavor to refine your Kernel.
智慧旅游解决方案利用云计算、物联网和移动互联网技术,通过便携终端设备,实现对旅游资源、经济、活动和旅游者信息的智能感知和发布。这种技术的应用旨在提升游客在旅游各个环节的体验,使他们能够轻松获取信息、规划行程、预订票务和安排食宿。智慧旅游平台为旅游管理部门、企业和游客提供服务,包括政策发布、行政管理、景区安全、游客流量统计分析、投诉反馈等。此外,平台还提供广告促销、库存信息、景点介绍、电子门票、社交互动等功能。 智慧旅游的建设规划得到了国家政策的支持,如《国家中长期科技发展规划纲要》和国务院的《关于加快发展旅游业的意见》,这些政策强调了旅游信息服务平台的建设和信息化服务的重要性。随着技术的成熟和政策环境的优化,智慧旅游的时机已经到来。 智慧旅游平台采用SaaS、PaaS和IaaS等云服务模式,提供简化的软件开发、测试和部署环境,实现资源的按需配置和快速部署。这些服务模式支持旅游企业、消费者和管理部门开发高性能、高可扩展的应用服务。平台还整合了旅游信息资源,提供了丰富的旅游产品创意平台和统一的旅游综合信息库。 智慧旅游融合应用面向游客和景区景点主管机构,提供无线城市门户、智能导游、智能门票及优惠券、景区综合安防、车辆及停车场管理等服务。这些应用通过物联网和云计算技术,实现了旅游服务的智能化、个性化和协同化,提高了旅游服务的自由度和信息共享的动态性。 智慧旅游的发展标志着旅游信息化建设的智能化和应用多样化趋势,多种技术和应用交叉渗透至旅游行业的各个方面,预示着全面的智慧旅游时代已经到来。智慧旅游不仅提升了游客的旅游体验,也为旅游管理和服务提供了高效的技术支持。
智慧旅游解决方案利用云计算、物联网和移动互联网技术,通过便携终端设备,实现对旅游资源、经济、活动和旅游者信息的智能感知和发布。这种技术的应用旨在提升游客在旅游各个环节的体验,使他们能够轻松获取信息、规划行程、预订票务和安排食宿。智慧旅游平台为旅游管理部门、企业和游客提供服务,包括政策发布、行政管理、景区安全、游客流量统计分析、投诉反馈等。此外,平台还提供广告促销、库存信息、景点介绍、电子门票、社交互动等功能。 智慧旅游的建设规划得到了国家政策的支持,如《国家中长期科技发展规划纲要》和国务院的《关于加快发展旅游业的意见》,这些政策强调了旅游信息服务平台的建设和信息化服务的重要性。随着技术的成熟和政策环境的优化,智慧旅游的时机已经到来。 智慧旅游平台采用SaaS、PaaS和IaaS等云服务模式,提供简化的软件开发、测试和部署环境,实现资源的按需配置和快速部署。这些服务模式支持旅游企业、消费者和管理部门开发高性能、高可扩展的应用服务。平台还整合了旅游信息资源,提供了丰富的旅游产品创意平台和统一的旅游综合信息库。 智慧旅游融合应用面向游客和景区景点主管机构,提供无线城市门户、智能导游、智能门票及优惠券、景区综合安防、车辆及停车场管理等服务。这些应用通过物联网和云计算技术,实现了旅游服务的智能化、个性化和协同化,提高了旅游服务的自由度和信息共享的动态性。 智慧旅游的发展标志着旅游信息化建设的智能化和应用多样化趋势,多种技术和应用交叉渗透至旅游行业的各个方面,预示着全面的智慧旅游时代已经到来。智慧旅游不仅提升了游客的旅游体验,也为旅游管理和服务提供了高效的技术支持。
深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值