LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1650|回复: 6

如何设置硬盘的dma

[复制链接]
发表于 2003-6-25 14:21:33 | 显示全部楼层 |阅读模式
如题:
在DEMSG的输出中看到如下信息:
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
我的硬盘是星钻(一代),主板芯片是KT133的,MANDRAKE 9.0
发表于 2003-6-25 14:27:45 | 显示全部楼层
在这个文件里设置
/etc/sysconfig/harddisk中设置。重新启动一下就可以。
 楼主| 发表于 2003-6-25 14:36:53 | 显示全部楼层
[                      sysconfig]$ pwd
/etc/sysconfig
[                       sysconfig]$ ls
alsa          drakconnect             mouse*            rawdevices
amd*          drakconnect.adsl_pppoe  msec*             routed
apmd          drakconnect.lan         msec.rpmnew       saslauthd
apm-scripts/  drakconnect.netc        network*          static-routes
autofsck      fetchmail               network.bak       syslog
autologin     i18n*                   networking/       system*
bootsplash    init                    network-scripts/  usb
clock*        installkernel           nfs*              xinetd
console/      ipvsadm*                pcmcia*
desktop*      keyboard*               printing
?????
NO   harddisk?
发表于 2003-6-25 15:12:14 | 显示全部楼层
[ghw@ghw ghw]$ cd /etc
[ghw@ghw etc]$ cd sys
sysconfig    sysctl.conf  syslog.conf
[ghw@ghw etc]$ cd sysconfig/
[ghw@ghw sysconfig]$ ls
authconfig  devlabel  grub       init         mouse       network-scripts  rawdevices           samba     tux
clock       dhcpd     harddisks  installinfo  named       ntpd             redhat-config-users  sendmail  xinetd
console     dhcrelay  hwconf     keyboard     network     pcmcia           redhat-logviewer     squid     yppasswdd
desktop     gpm       i18n       kudzu        networking  pgsql            rhn                  syslog

看我的?看到没有?
下面是它的内容:

[ghw@ghw sysconfig]$ more harddisks
# These options are used to tune the hard drives -
# read the hdparm man page for more information

# Set this to 1 to enable DMA. This might cause some
# data corruption on certain chipset / hard drive
# combinations. This is used with the "-d" option

USE_DMA=1

# Multiple sector I/O. a feature of most modern IDE hard drives,
# permitting the transfer of multiple sectors per I/O interrupt,
# rather than the usual one sector per interrupt.  When this feature
# is enabled, it typically reduces operating system overhead for disk
# I/O by 30-50%.  On many systems, it also provides increased data
# throughput of anywhere from 5% to 50%.  Some drives, however (most
# notably the WD Caviar series), seem to run slower with multiple mode
# enabled. Under rare circumstances, such failures can result in
# massive filesystem corruption. USE WITH CAUTION AND BACKUP.
# This is the sector count for multiple sector I/O - the "-m" option
#
MULTIPLE_IO=16

# (E)IDE 32-bit I/O support (to interface card)
#
EIDE_32BIT=3

# Enable drive read-lookahead
#
# LOOKAHEAD=1

# Add extra parameters here if wanted
# On reasonably new hardware, you may want to try -X66, -X67 or -X68
# Other flags you might want to experiment with are -u1, -a and -m
# See the hdparm manpage (man hdparm) for details and more options.
#
EXTRA_PARAMS=-X100
[ghw@ghw sysconfig]$
 楼主| 发表于 2003-6-25 19:51:03 | 显示全部楼层
呵呵,你的的确有,我的就....
我的是MANDRAKE9.0,不知道黄叶版主用的是什么版本的
谢谢了.
发表于 2003-6-25 20:22:31 | 显示全部楼层
作者:panda

  目前很多朋友都用上了大容量的DMA或UDMA-33标准的硬盘。在微软的Windows98下为
了使得DMA或UDMA-33标准的硬盘提高数据传输速率,可以在计算机的CMOS或操作系统中打
开IDE硬盘的DMA(直接存储器存取)这项功能。但是在Linux平台中,Linux是不会自动的打
开DMA模式,所以在Linu
x中使用这些IDE接口的UDMA-33标准的硬盘感觉数据传输远远没有在Windows中快。事实上
,Linux平台中也可以通过软件来打开DMA模式,以下就是Linux下的硬盘提速的具体做法



  首先,在Linux下打开DMA模式之前,最重要的事情就是备份硬盘上的数据。因为在开
启DMA模式之后谁也无法预料到硬盘是否还能正常工作,数据是否还完整。把Linux下所有
的重要数据备份到其他硬盘或是CD-R等存储媒介上是最好的选择,请不要把数据备份在同
一块硬盘上,更不能把
数据备份到同一个硬盘分区。
第二步需要修改hdparm目录下的一些设备节点参数。但是修改这些参数必须以超级用户(
ROOT)的身份登陆Linux系统才行。普通Linux用户没有这个权限修改hdparm目录下的东西
。下面就是一个修改硬盘设备节点参数的例子,注意,不同型号,不同容量的硬盘可能列
出的参数不太一样,但
是修改的过程和方法大体上是一样的。

# /sbin/hdparm /dev/hda
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 629/240/63, sectors = 9514260, start = 0
#

  要注意的是,OFF代表此参数不起作用,ON表示打开此功能或模式。上面的参数列表
写的非常清楚,Multcount(多扇区读) 没有打开;此硬盘格式为16位格式;DMA数据传
输模式没有打开。很显然,这样的参数并没有使硬盘达到最佳的优化,没有能完全发挥当
今高速IDE硬盘的性能。
为了优化硬盘,提高硬盘的数据传输速率,首先还是要了解以下这些参数的含义:

c3 :就是把硬盘的16位格式转换为32位模式。
m16 :改变硬盘的多路扇区的读功能,-m16可以使得硬盘一次读入16个扇区的数据。但是
不是所有的硬盘都支持这个功能。使用hdparm -i /dev/hda 可以察看您的硬盘最大能读
写的扇区数目。
d1X34 在支持DMA-capable的硬盘中,这个参数可以支持双DMA通道的数据传输模式。
d1X66 在支持UDMA-capable的硬盘中,这个参数可以支持双DMA通道的数据传输模式。
  了解以上参数的作用和含义之后,现在请您仔细检查硬盘上面上的标签,看看您的硬
盘是否支持DMA 或者 UDMA模式,然后才对照这些参数来优化您的硬盘,以防出现不可预
见的错误。
优化硬盘的参数,也可以参考下面的例子,注意,不是所有的硬盘都适用一下的优化参数
,请按照实际情况来设置参数:


# hdparm -d1X66 -m16 -c3 /dev/hda
# hdparm /dev/hda
/dev/hda:
multcount = 16 (on)
I/O support = 3 (32-bit w/sync)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 629/240/63, sectors = 9514260, start = 0

  修改完这些参数之后,有时候并不能一次性把硬盘优化成功。如果在硬盘还在正常工
作的时候修改这些数据,硬盘会进入“休眠”状态。这就需要等硬盘灯会熄灭,硬盘不处
于繁忙状态下优化硬盘参数比较容易成功。

  hdparm的改变是一个临时的状态,下次再次启动Linux系统的时候hdparm将会消失。
所以要想永久的保存修改后的信息,就必须把修改后的参数和数据写入/etc/rc.d/rc.loc
al或者/etc/rc.local文件,甚至比启动过程要早运行的程序中。

  最后要提醒大家的是,如果您的主板的芯片组或Linux内核kernel(比如内核kernel
版本过于陈旧,2.2版以前)如果不支持UDMA模式,那就没有必要去修改硬盘设备的参数了
。升级主板或者kernel是解决这个问题的较好选择。






来源:Linux专区  

--

※ 来源:·BBS 水木清华站 smth.org·[FROM: 159.226.41.166]
发表于 2003-6-26 09:15:58 | 显示全部楼层

我的经验是hdparam的使用与主版芯片有关。ICH4必须在2。4。20上才能应用

我的经验是hdparam的使用与主版芯片有关。ICH4必须在2。4。20上才能应用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表