现在的主板和硬盘都支持UltraDMA 100,老点的主板如VIA 693,Intel 810芯片组主板只支持UltraDMA 66,但VIA 694和Intel 815以后芯片主板都支持UltraDMA 100,有些VIA 芯片主板甚至支持UltraDMA 133,在主板、硬盘和数据连接排线都能支持相应标准的前提下,我们可以通过以下命令让硬盘工作在相应的模式下,加快Linux的运行速度。具体大家查找命令参数
1) 命令:hdparm -d1X66 -m16 -c3 -k1 /dev/hda
setting xfermode to 66 (UltraDMA mode2,UltraDMA 66)
2) 命令:hdparm -d1X68 -m16 -c3 -k1 /dev/hda
setting xfermode to 68 (UltraDMA mode4,UltraDMA 66)
3) 命令:hdparm -d1X69 -m16 -c3 -k1 /dev/hda
setting xfermode to 69 (UltraDMA mode5,UltraDMA 100)
4) 命令:hdparm -d1X70 -m16 -c3 -k1 /dev/hda
setting xfermode to 70 (UltraDMA mode6 UltraDMA 133)
如本人计算机:
[root@l ~]#uname -a
Linux l.myhome 2.6.9 Thu Feb 8 00:18:10 CST 2007 i686 i686 i386 GNU/Linux
[root@l ~]#hdparm -d1X69 -m16 -c3 -k1 /dev/hda
/dev/hda:
setting 32-bit IO_support flag to 3
setting multcount to 16
setting using_dma to 1 (on)
setting keep_settings to 1 (on)
setting xfermode to 69 (UltraDMA mode5)
multcount = 16 (on)
IO_support = 3 (32-bit w/sync)
using_dma = 1 (on)
keepsettings = 1 (on)
[root@l ~]#hdparm -i /dev/hda
/dev/hda:
Model=Maxtor 5T030H3, FwRev=TAH71DP0, SerialNo=T3H2K61C
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60030432
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当前硬盘工作模式,ATA 100
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: ATA/ATAPI-6 T13 1410D revision 0:
* signifies the current active mode
以上命令中的1)和2)都可以放在/etc/rc.local文件最后自动加载,但3)和4)放在那里好象有点问题,我没其他好方法,只好让系统进入桌面时自动加载,做法是在/usr/share/autostart文件夹建立一个自动启动文件harddisk.desktop,里面的内容为:
[Desktop Entry]
Comment[zh_CN]=硬盘加速
Exec=hdparm -d1X69 -m16 -c3 -k1 /dev/hda
Icon=cache
Name=Autorun
Name[zh_CN]=硬盘加速
Type=Application
至于这个文件的图标,你自己喜欢什么就选什么吧,呵呵
今天又实验了一下2.6.20内核,发现内核自动判断驱动器工作模式,hdparm命令有些参数变得失效,算内核的一个小进步吧。
[root@l ~]#uname -a
Linux l.myhome 2.6.20 Thu Feb 8 00:18:10 CST 2007 i686 i686 i386 GNU/Linux
[root@l ~]#hdparm -d1X66 -m16 -c3 -k1 /dev/hda
设置硬盘工作在DMA 66模式
/dev/hda:
setting 32-bit IO_support flag to 3
setting multcount to 16
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Operation not permitted,设置硬盘DMA工作模式:操作不允许,命令参数无效
setting keep_settings to 1 (on)
setting xfermode to 66 (UltraDMA mode2)
multcount = 16 (on)
IO_support = 3 (32-bit w/sync)
using_dma = 0 (off)
keepsettings = 1 (on)
[root@l ~]#hdparm -i /dev/hda
/dev/hda:
Model=Maxtor 5T030H3, FwRev=TAH71DP0, SerialNo=T3H2K61C
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60030432
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还是工作在DMA100
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: ATA/ATAPI-6 T13 1410D revision 0:
* signifies the current active mode