How to enable hard disk DMA in Linux

Source: Internet
Author: User
Article Title: How to enable hard disk DMA in Linux. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories. Note: The/sbin/hdparm command does not support SATA hard disks.

32-bit I/O and DMA in Linux are disabled by default. If 16-bit I/O is used, the computer performance cannot be fully utilized.

If you want to enable 32-bit I/O and DMA, you need to set it as root. To reduce the damage to the file system caused by system restart due to an error, it is best to use the single-user mode.

First, run the following command to check the current I/O of the hard drive:

[Root @ anima lwg] #/sbin/hdparm-t/dev/hda

/Dev/hda:

Timing buffered disk reads: 8 MB in 3.31 seconds = 2.42 MB/sec

[Root @ anima lwg] #

To display the current I/O and DMA settings, run the following commands:

[Root @ anima lwg] #/sbin/hdparm-c/dev/hda (display current I/O settings)

/Dev/hda:

IO_support = 0 (default 16-bit)

[Root @ anima lwg] #/sbin/hdparm-d/dev/hda (display the current DMA settings)

/Dev/hda:

Using_dma = 0 (off)

[Root @ anima lwg] #

Through the above command, we know that 32-bit I/O and DMA are disabled now. You can use the following command to open them respectively:

[Root @ anima lwg] #/sbin/hdparm-c 1/dev/hda (enable 32-bit I/O)

/Dev/hda:

Setting 32-bit IO_support flag to 1

IO_support = 1 (32-bit)

[Root @ anima lwg] #/sbin/hdparm-d 1/dev/hda (enable DMA)

/Dev/hda:

Setting using_dma to 1 (on)

Using_dma = 1 (on)

[Root @ anima lwg] #

Use the following command to make the settings take effect:

[Root @ anima lwg] #/sbin/hdparm-k 1/dev/hda

/Dev/hda:

Setting keep_settings to 1 (on)

Keepsettings = 1 (on)

[Root @ anima lwg] #

Okay! Now let's look at the I/O of the drive:

[Root @ anima lwg] #/sbin/hdparm-t/dev/hda

/Dev/hda:

Timing buffered disk reads: 116 MB in 3.03 seconds = 38.34 MB/sec

[Root @ anima lwg] #

As you can see, the I/O performance of the system has improved a lot.

However, the above settings are only valid for the current system. When you restart the system again, you have to reset the settings.

If you want to enable DMA every time the system starts, you can add the following command to the/etc/rc. d/rc. local file:

[Root @ anima lwg] # echo "/sbin/hdparm-c 1-d 1-k 1/dev/hda">/etc/rc. d/rc. local

[Root @ anima lwg] #

 

[1] [2] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.