linux操作之: 設定硬碟DMA,提高linux讀寫速度

來源:互聯網
上載者:User
開啟硬碟 DMA 支援。

系統安裝完畢後,硬碟的 DMA 是沒有開啟的,我的方法是在
/etc/rc.d/rc.local 最後面加上一行 /sbin/hdparm -d1 -c3 -m16 /dev/hda,註:我的硬碟是sda, 這樣每次開機後,硬碟的 DMA 就會開啟,不必每次手動設定。

如果您的硬碟機支援 ATA33 可以加上 -X66 這個參數,ATA66則是 -X68,像我的硬碟是 ATA66 那麽完整參數就是 /sbin/hdparm -d1 -X68 -c3 -m16 /dev/hda 經過我的測試 ,在 DMA 未開啟以前,實際讀取效率是每秒約 4.10 Mb 左右,開啟 DMA 後,每秒實際讀取效率躍升為 20 Mb 大約提升 5 倍之多。

§未開啟 DMA 時的測試

[root@firefly /root]# hdparm -d0 /dev/hda

/dev/hda:

setting using_dma to 0 (off)
using_dma = 0 (off)

[root@firefly /root]# hdparm -Tt /dev/hda

/dev/hda:

Timing buffer-cache reads: 128 MB in 2.75 seconds = 46.55 MB/sec
Timing buffered disk reads: 64 MB in 15.58 seconds = 4.11 MB/sec

§開啟 DMA 後的測試結果

[root@firefly /root]# hdparm -d1 -X68 -c3 -m16 /dev/hda

/dev/hda:

setting 32-bit I/O support flag to 3
setting multcount to 16
setting using_dma to 1 (on)
setting xfermode to 69 (UltraDMA mode5)
multcount = 16 (on)
I/O support = 3 (32-bit w/sync)
using_dma = 1 (on)

[root@firefly /root]# hdparm -Tt /dev/hda/dev/hda:

[root@BTazuo d]# /sbin/hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   958 MB in  2.00 seconds = 478.53 MB/sec
 Timing buffered disk reads:  168 MB in  3.00 seconds =  55.93 MB/sec
[root@BTazuo d]#

由以上的資料,可以看得出來,硬碟 DMA 是否開啟,對讀取效率影響很大。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.