Checking and Tuning Your Hard Disk

来源:互联网 发布:云组态软件 编辑:程序博客网 时间:2024/05/17 09:04

To get the best performance out of your harddisk, you sometimes have to do a bit of tuning. Although Linux willproperly detect and configure most hard disks so they will work,sometimes the default settings will be either too conservative (so youget slow performance) or too aggressive (not as likely, but can resultin errors).

This section describes how to display information aboutyour hard disk. It then describes different ways of tuning disk optionsand benchmarking the results of those changes.

Getting Information About Your Disk

You can find out information about your hard disk using hdparm, fdisk, and other commands. To find out some general information, you could start out with hdparm simply followed by the name of the disk device. For example, you would identify the first IDE (ATA) hard disk using /dev/hda in the following command line:

   # hdparm /dev/hda
/dev/hda:
multcount = 16 (on)
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using-dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 4865/255/63, sectors = 78165360, start = 0

The output shows some basic information about your harddisk. You can also list most of these items separately using optionsdescribed below:

  • multcount-With multcountset to a number other than 0, IDE block mode is enabled. This allowsmultiple sectors to be transferred with each I/O interrupt (2, 4, 8,16, or 32 sectors). Type hdparm-m /dev/hda to list just this line.

  • IO support-IO support setto 1 indicates that the hard disk supports 32-bit data transfers acrossthe bus (usually PCI) to the interface card. From the interface card tothe hard drive, data actually only uses a 16-bit connection over theribbon cable. To take advantage of the 32-bit bus, however, data ispackaged together in two 16-bit groups before it is sent to RAM or theCPU. Type hdparm-c /dev/hda to list just this line.

  • unmaskirq-The unmaskirqsetting of 1 turns on the ability of the disk's driver to unmask otherinterrupts while processing a disk interrupt (to improve performance).Type hdparm-u /dev/hda to list just this line.

  • using dma-Describeswhether or not DMA is on for the hard drive (1 is on; 0 is off). If thehard drive supports DMA, having DMA on can improve performancesubstantially. It should improve I/O throughput without increasing CPUuse.

  • keepsettings-Shows whether or not DMA (-d), multcount (-m), and unmaskirq (-u)settings are kept after a soft reset. This is typically off, so that areset will change settings back to a sane state in case of bad -dmu settings. Type hdparm-k/dev/hda to list just this line.

  • readonly-Tells whether ornot the hard disk device is set for read-only. If read-only is on (1),no write operations are allowed to the disk. Type hdparm-r/dev/hda to list just this line.

  • readahead-This settingdescribes whether read-ahead seeks are on and, if so, how many sectorsare read ahead. During large sequential reads, performance can improveby reading ahead some number of sectors, in anticipation that they willbe needed by the operation requesting the data. The default eightsectors causes the file system to read ahead 4kb of data. Type hdparm-a/dev/hda to list just this line.

  • geometry-Displaysinformation about the disk's geometry. From the output just shown, youcan see that the hard disk has 4,865 cylinders, 255 tracks, and 63sectors per tracks. The total number of addressable sectors is78,165,360. The starting offset of the device is 0. Type hdparm-g/dev/hda to list just this line.

To display detailed identification information about your hard drive, you can use the hdparm -i command. The information displayed by hdparm-i was detected from the hard drive when you booted the computer. Here is an example:

   # hdparm -i /dev/hda
/dev/hda:

Model=WDC WD400JB-00ENA0, FwRev=05.03F05, SerialNo=WD-WCAD13418938
Config={HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq}
RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=40
BuffType=DualportCache, BuffSize=8192kB, MaxMultSect=16, MultSect=16
CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=78165360
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

The model of this hard drive is a Western DigitalWD400JB Caviar 40GB hard drive. If you ever need to contact technicalsupport team about the drive, you can see the firmware revision (FwRev)and serial number (SerialNO) for the drive from this output. Becauseyour settings can change after Linux starts running, you can seecurrent hard drive settings using the -I option as follows:

   # hdparm -I /dev/hda
/dev/hda:
ATA device, with non-removable media
Model Number: WDC WD400JB-00ENA0
Serial Number: WD-WCAD13418938
Firmware Revision: 05.03E05
Standards:
Supported: 5 4 3 2
Likely used: 6
Configuration:
Logical max current
cylinders 16383 4047
heads 16 16
sectors/track 63 255
--
CHS current addressable sectors: 16511760
LBA user addressable sectors: 78165360
device size with M = 1024*1024: 38166 MBytes
device size with M = 1000*1000: 40020 MBytes (40 GB)
Capabilities:
LBA, IORDY(can be disabled)
bytes avail on r/w long: 40 Queue depth: 1
.
.
.

The information just shown was obtained directly fromthe current drive. So if you have done any disk tuning since the systembooted, this output (rather than output from -i) should be used. Near the end of this output is the Commands/features section. This section shows features that are supported by the drive. If the feature is supported, an asterisk appears in the Enabled column. Here's an example of the commands/features output from hdparm-I for a Western Digital WD800JB 80 GB hard drive:

   Commands/features:
Enabled Supported:
* READ BUFFER cmd
* WRITE BUFFER cmd
* Host Protected Area feature set
* Look-ahead
* Write cache
* Power Management feature set
Security Mode feature set
* SMART feature set
* FLUSH CACHE EXT command
* Mandatory FLUSH CACHE command
* Device Configuration Overlay feature set
* 48-bit Address feature set
Automatic Acoustic Management feature set
SET MAX security extension
* DOWNLOAD MICROCODE cmd
* SMART self-test
* SMART error logging

Many of the features described in the next sectionare listed in this section. As you turn these features on and off,you'll notice the asterisk in the Enabled column going on and off whenyou re-run hdparm-I.

Changing Hard Disk Settings

The hdparm utility is one of the key tools forsetting parameters for tuning your hard disk. Before we talk aboutchanging disk settings with hdparm, however, take a look at the firstcomment in the configuration file (/etc/sysconfig/harddisks) that comes with the hdparm utility:

   WARNING!!!
The kernel will autodetect the correct settings for most
drives. Overriding these settings with hdparm can cause data
corruption and/or data loss.

I think it's a great idea to practice and learn aboutsome of the more potentially destructive features of hdparm on a testcomputer-or at least on a computer before it is deployed in yourbusiness. With that said, however, there are times when you might wantto override some conservative defaults to improve the performance ofyour hard disk.

This section describes some ways of using hdparm tocheck and tune your disks. It also describes ways of benchmarking yoursystem to check whether the options have improved or affected your diskperformance.

Benchmarking Your Changes

A common practice is to check the performance ofyour hard disk before and after you make changes to it. This gives yousome idea of the effect of your changes. Common tools for testing yourhard disk performance (as well as the general act of reading andwriting data on your system) are the hdparm-Tt and time commands. I also describe the bonnie utility for testing performance, which is not part of Fedora or other Red Hat Linux distributions.

Timing Reads

Using hdparm, you can time cache reads (-T) and device reads (-t).

  • -T option-This option essentially checks the how quickly data can be passed between the processor, memory, and disk cache.

  • -t option-Thisoption reads continuously from the hard disk without reading previouslycached data. This gives an indication of the speed at which Linux canread sequential data from the disk.

Here's an example of hdparm-Tt:

   # hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 1476 MB in 2.00 seconds = 740.00 MB/sec
Timing buffered disk reads: 164 MB in 3.01 seconds = 35.18 MB/sec

The output just shown is from a Western Digital Caviar80MB hard drive (WDC WD800JB). The first line of output shows thenumber of MB of data (1,476MB) that can be read from cache in about 2seconds, without touching the hard disk at all. The second line showsthe number of MB of data (164MB) that can be read from the hard diskdirectly in about 3 seconds.

By way of comparison, I ran the same command on a Quantum Bigfoot CY6480A 6GB hard drive:

   # hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 128 MB in 2.01 seconds = 63.56 MB/sec
Timing buffered disk reads: 20 MB in 3.31 seconds = 6.04 MB/sec

You can see that the reads are considerably slower fromthis circa 1996 hard drive (not a bad command to try if you are lookingto buy a used computer).

Here are a few tips for benchmarking with hdparm-Tt to get the best results:

  • Have as few processes as possible active when you do the benchmark. (You can run the top command to see active processes. Type P (which is the default) to sort by CPU usage. Then you can kill any very active processes that you don't need.)


    Caution 

    Don't just randomly go killing processes, evenprocesses that are consuming a lot of CPU time. A better idea might beto go into single-user mode, since that should provide you with asystem with very little activity.

  • Run it a few times, to be sure a momentary hiccup doesn't skew your results.

  • Have some free memory available. (If you are using top, press M to sort by memory usage and kill any process that is not required to free some memory.)

Timing Writes

To test options that change how writing is doneto a disk (such as write-caching), you can simply time a large writeoperation with the options on or off. Here is an example where I usedthe time command to see how long it would take to copy a large file (inthis case, a 637MB iso image) from one partition to another:

   # time cp severn-i386-disc1.iso /root
real 0m34.295s
user 0m0.110s
sys 0m7.860s


Note 

Because the I/O speed depends to some extent onthe location of the data on the platter, you will probably getdifferent results from running the exact same command several times. Byrunning it a few times, however, you can get an idea of the averageamount of time the command takes.

The example just shown copies the iso image from the current directory to the /rootdirectory. The time command shows that the operation took 34.295seconds in real time. The user and sys lines show the amount of CPUtime that was consumed by user-space calls and from kernel-space calls,respectively. Next, I turned off the write-caching feature (hdparm -W0), removed the iso file from /root, and ran the command again:

   # time cp severn-i386-discl.iso /root
real 1m59.077s
user 0m0.60s
sys 0m8.900s

You can see that the copy took about four times as long(1 minute, 59.077 seconds) to complete. So, if you are willing to riskpossible data loss in case power goes out, you can see that the timecommand shows significant improvement in completing a large copyoperation with write-caching on in this case. (Of course, if you arethat worried about data loss due to power going out, you should get aUPS.)

Instead of a plain copy, you can use the dd command to take a bit more control over the writes you test. With dd, you can precisely specify the block size and the number of blocks being copied. Using /dev/zero as the input file, you can copy as many "/0" characters to the output file as you like. Here's an example:

   # time dd if-/dev/zero of=/tmp/my-file bs=8k count=65536
65536+0 records in
65536+0 records out
real 1m7.649s
user 0m0.030s
sys 0m3.780s

This created a 513MB /tmp/my_file.I can adjust the blocksize from 8k or the count from 65536 to test thedisk performance based on different amounts and sizes of data.

Checking Reads, Writes, and CPU with Bonnie

Bonnie is a nice tool for checking performance ofyour hard disk, CPU, and other components in ways that emulate how thesystem is actually used. Using bonnie, you can check the actual systemcalls that are being made by the kernel to different devices as well aslibrary calls to the basic libc library. The following are the types ofperformance activities you can check with bonnie:

  • Programs that read and write single characters-Bonnie can test writes of single characters (putc call) and (getccall) to hard disks. The potential bottleneck for these operations isthe time it takes to make libc library calls on your computer.

  • Programs that read and write blocks of data-Bonnie can test writes (write call) and reads (readcall) of blocks of data. Because performance of these activities mayreflect buffering (that is, data that is in memory but not beingcurrently read or written to hard disk), you might want to add someoptions to insure that you are testing disk performance and not justbuffering. With the -y option to bonni e, buffered data is synced tohard disk after each write.

  • Database applications-Bonniecan test activities that are similar to the way applications accessdata in a database. The block in/out rewrite test that bonnie doesinteracts with data on a hard disk by reading some data, changingseveral bytes, writing the data back to disk, and rereading the data.This is a kind of overall test of how well your system might handledatabase access.

  • Busy system-By requesting more data than the system can handle (using the lseekcall), bonnie can emulate how an overloaded system will perform. Thistests how fast the hardware is at randomly accessing data from the harddisk.

The Bonnie project (www.textuality.com/bonnie)contains descriptions of bonnie and links where you can get thesoftware (it's not included in any Red Hat distribution). I found aSuSE RPM version at www.garloff.de/kurt/linux/bonnie,which had a few nice enhancements. You can build from the source RPMyou get there or use the SuSE i386 binary (which seems to work fine onFedora and other Red Hat systems). You can also get that package from rpmfind.net (until they change the release number) by typing the following (all on one line):

   # wget rpmfind.net/linux/SuSE-Linux/i386/8.2/suse/i586/bonnie-1.4-
124.i586.rpm

It is a good idea to run bonnie with amount of datalarger than the default (100MB by default). Likewise, for a better testof hard disk performance, adding the -y option will work the disk harder by syncing all writes to disk. I ran the following bonnie command with write-caching on (hdparm-W1/dev/hda) or you could drop -y if write-cashing is off:

   # bonnie -s 300 -y
Bonnie 1.4: File './Bonnie.18177', size: 314572800, volumes: 1
Writing with putc()... done: 20386 kB/s 89.0 %CPU
Rewriting... done: 15913 kB/s 25.1 %CPU
Writing intelligently... done: 34819 kB/s 31.8 %CPU
Reading with getc()... done: 20819 kB/s 95.6 %CPU
Reading intelligently... done: 36583 kB/s 31.3 %CPU
Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done...
---Sequential Output (sync)----- ---Sequential Input- -Rnd Seek-
-Per Char- --Block--- -Rewrite-- -Per Char- --Block--- -04k (03)
Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU
toy 1* 300 20386 89.0 34819 31.8 15913 25.1 20819 95.6 36583 31.3 257.2 1.7

With the command just shown, 300MB of data (- s 300) is used for each operation and all writes are synced to disk (-y). Assuming a system with little or no extra activity, the CPU numbers above show cases where character-at-a-time writes (putc) and reads (getc)proceed about as fast as the processor can handle (89.0% and 95.6%,respectively). The hard disk, rather than the CPU, is the bottleneckfor block writing and reading (31.8% and 31.3%, respectively), as wellas rewriting (25.1%).

After that, I turned off write cache (hdparm-W0/dev/hda) and ran bonnie again.

   # bonnie -s 300 -y
Bonnie 1.4: File './Bonnie.18151', size: 314572800, volumes: 1
Writing with putc()... done: 5950 kB/s 26.0 %CPU
Rewriting... done: 5070 kB/s 8.0 %CPU
Writing intelligently... done: 6179 kB/s 5.6 %CPU
Reading with getc()... done: 20820 kB/s 96.0 %CPU
Reading intelligently... done: 33795 kB/s 29.7 %CPU
Seeker 1...Seeker 2...Seeker 3...start 'em...done...done ...done ...
---Sequential Output (sync)----- ---Sequential Input- -Rnd Seek-
-Per Char- --Block--- -Rewrite-- -Per Char- --Block--- -04k (03)
Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU
toy 1* 300 5950 26.0 6179 5.6 5070 8.0 20820 96.0 33795 29.7 226.2 1.8

As you might guess, writing to disk in particularslowed down quite a lot. Writing operations were three to five timesfaster with write cache enabled. For more information on options to usewith bonnie, see the bonnie man page or the bonnie README file (in /usr/share/doc/ packages/bonnie).

Enabling Disk Write-Back and Read-Ahead Caches

You can improve overall write performance todisks by enabling disk write-back caches. Likewise, tuning the disk todo read-ahead caches can improve disk read performance when largeamounts of sequential data are requested from the hard disk.

Turning on Write-Back Cache

With the write-back option on, a write operationcan appear to be done after data is written to cache, but before it isactually moved to the hard disk. The driver can move on to get moredata, and delays that come from slow seek times and disk revolutionscan be made up over time.

Risks to enabling write-back caches include:

  • Power failures-If someonekicks out the power cord or if there is a power surge, it is possiblethat data the driver has been told was written to hard disk is not yetwritten on the physical hard disk. This can lead to data corruption.

  • Data flushed out of order-It'spossible that a second data block can be flushed to disk before thefirst block arrives, which might also cause data corruption.

  • Data might become inconsistent-Ininstances where data must always be consistent, write-back cachingshould be turned off. In RAID systems where write stripes can spanmultiple disks, it is more likely for inconsistencies to arise ifwrite-back caching is on.

Most modern hard drives have write cashing enabled bydefault. In fact, in many cases, the driver will not let you disableit. However, with some older hard drives, you can risk data corruptionby turning this feature on. In fact, the hdparm command labels this feature as DANGEROUS.

If this feature is not already on (and you haveassessed the risk of data loss as acceptable), you can turn onwrite-caching using the following command:

   # hdparm -W1 /dev/hda
/dev/hda:
setting drive write-caching to 1 (on)

When I used the time command to time a large file copy (see the Timing Writes section), there was significant real-time improvements (about four times faster) with write-caching on (-W1).

Turning on Read-Ahead Cache

With the read-ahead cache option turned on (whichis the case by default in most cases), the hard disk's driver will readahead a specified amount of data with the assumption that the readaction will need more data. If the feature is turned on, you should seethe following near the end of hdparm -I output:

   Commands/features:
Enabled Supported:
* Look-ahead

You use the -A option to turn on (1) or off (0) the read-ahead feature. The following shows the feature being turned on:

   # hdparm -A1 /dev/hda
/dev/hda:
setting drive read-lookahead to 1 (on)

With read-ahead on, you can try different values to set how far ahead data should be read. You do that with the -a option. For example, to set the read-ahead value to eight sectors (4KB) you would type

   # hdparm -a8 /dev/hda
/dev/hda:
setting fs readahead to 8
readahead = 8 (on)

With a slow, older hard disk, it can help to have ahigher read-ahead value (to a point). The following examples show howread performance differed when I changed the read-ahead values with myold Quantum Bigfoot hard drive (described earlier).


Note 

Notice that changing the read-ahead value doesn'thave any impact on the buffer-cache test. That's because thebuffer-cache reads test only gets data from cache and doesn't touch thehard disk.

The following shows read performance with read ahead turned off (-A0). I had similar results when I set read ahead to 8 (-a8).

# hdparm -a8 /dev/hda
# hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 128 MB in 2.00 seconds = 63.98 MB/sec
Timing buffered disk reads: 10 MB in 3.60 seconds = 2.77 MB/sec

The next example shows how performance improved with read ahead set to 128 (I had similar results on setting it to 256):

# hdparm -a128 /dev/hda
# hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 128 MB in 2.01 seconds = 63.69 MB/sec
Timing buffered disk reads: 22 MB in 3.24 seconds = 6.79 MB/sec

Setting read ahead to 64 resulted in improved performance, although not quite as much as setting it to 128 or 256:

# hdparm -a64 /dev/hda
# hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 128 MB in 2.01 seconds = 63.56 MB/sec
Timing buffered disk reads: 20 MB in 3.25 seconds = 6.16 MB/sec

Turning on DMA

Hard disks typically support several differentmodes for transferring data, direct memory Access (DMA) is enabled onmost hard disks today by default. In most cases, DMA will be turned onand the best possible DMA mode will be enabled. Older disks that don'toperate in DMA mode can operate in the slower PIO mode. Here aredescriptions of popular transfer modes for IDE/ATA hard disks:

  • Programmed I/O (PIO)-Thisis a fairly safe transfer mode, but requires a lot of CPU overhead andresults in slower data transfers. Available modes include pio0, pio1,pio2, pio3, and pio4.

  • Multiword DMA (MDMA)-MultiwordDMA allows the hard disk to communicate directly with system memory,bypassing the CPU. It does this using a feature called bus mastering,which lets the hard disk device control the PCI bus. Available modesinclude mdma0, mdmal, and mdma2.

  • Ultra DMA (UDMA)-UDMArefers to certain DMA modes that operate at a much higher rate of speedthan multiword DMA rates. Available UDMA modes include udma2 (ATA/33),udma4 (ATA/66), udma5 (ATA/100), and udma6 (ATA/133).


Caution 

Use caution when you are changing DMA settings. Linux will let you switch to an unsupported DMA mode using hdparm, which could result in data corruption. Be sure to back up any important data before trying different DMA modes.

To enable UDMA, your computer's BIOS must support DMAand the I/O controller and the hard drive itself must be capable ofUDMA transfers. For modes greater than udma2, your hard disk must beconnected with a 40-pin, 80-conductor cable. The hard disk shouldreport which DMA modes it supports. Here's an example of the portion ofhdpa rm- i output that describes supported DMA modes:

   # hdparm -i /dev/hda
.
.
.
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5

The asterisk next to udma5 shows that it is the modethat was activated during boot time. To see the current setting (incase you changed it), use the hdparm -I option. To turn on DMA mode, you can use the hdparm-d option and to switch DMA modes you use the -Xoption. For example, to turn on DMA and set the current mode to mdma2for the first IDE hard disk, you could type the following:

   # hdparm -d1 -X34 /dev/hda
/dev/hda:
setting using_dma to 1 (on)
setting xfermode to 34 (multiword DMA mode2)
using_dma = 1 (on)

Table 9-1 shows the different -X values you could use to set different DMA and PIO modes.

Table 9-1: DMA and PIO Transfer Modes

Mode

Option to hdparm

Theoretical Maximum Transfer Rate

pio0

-X08

3.3MB per second

pio1

-X09

5.2MB per second

pio2

-X10

8.3MB per second

pio3

-X11

11.1MB per second

pio4

-X12

16.7MB per second

mdma0

-X32

4.2MB per second

mdma1

-X33

13.3MB per second

mdma0

-X34

16.6MB per second

udma0

-X64

16.7MB per second

udma1

-X65

25MB per second

udma2

-X66

33.3MB per second

udma3

-X67

44.4MB per second

udma4

-X68

66.7MB per second

udma5

-X69

100MB per second

Again, most times Linux will probe the bestavailable DMA settings for your hard drive and configure it correctly.You can change them as just described, however, if you feel that thesettings were either too conservative or too aggressive. After youchange these modes, try running some benchmarks described earlier tochoose the mode that is working best.

Trying Other Disk Tuning Options

Here are a few other parameters you can tune with hdparm:

  • Block mode transfers-Turnon multisector I/O mode (also called IDE Block Mode) to allow thedriver to transfer more than one sector for each I/O interrupt. The -m0option turns off this feature. A number other than zero sets the amountof data transferred in each interrupt to that number (-m2, -m4, -m8, or-m16). This is often set to 16 for 16 sector transfers. (See theMaxMultSect setting from the hdparm- i output to see the maximum number you can set multcount to.)

  • Hard disks with smaller drive buffers may performbetter with smaller sector counts. This includes some WD Caviar drives.The following is an example of this option being set to 16:

    # hdparm -m16 /dev/hda
    /dev/hda:
    setting multcount to 16
    multcount = (on)
  • Keep settings over reset-Yougot your disk tuned just the way you want it. So you want to preserveall your settings as long as your machine stays up. The problem is thatonce the drive is reset, your drive goes back to all the defaultoptions. To override that behavior, you can use the hdparm options - k1 (to preserve -dma options) or -K1 (to preserve -APSWXZ options).


    Note 

    The -K1 option onlypreserves settings over a reset of the disk drive controller. To makethe changes permanent across a computer reboot, see the Making hdparm Changes Permanent section.

  • Set options quietly-When you set options in a configuration file or any other time that you don't want any output, you can add the - q option in front of each option. For example, hdparm_qd1-qX69/dev/hda will suppress output when turning on DMA support and udma5 mode.

Making hdparm Changes Permanent

Once you find hdparm settings you like, you can make them permanent in Fedora and other Red Hat Linux systems by adding them to the /etc/sysconfig/harddisksfile. That way, the settings are used each time you boot your computer.You can set some options by simply uncommenting appropriate lines fromthe hard disk file. For example:

   USE_DMA=1
MULTIPLE_10=16
EIDE_32BIT=3
LOOKAHEAD=1

By uncommenting those lines (removing the "#"character) you can turn on DMA, enable I/O transfer in multiple sectors(16 as set here), enable 32-bit I/O support, and turn on the read-aheadfeature, respectively. As an alternative, you can add hdparm parametersdirectly to the EXTRA_PARAMS line at the end of this file. For example:

   EXTRA_PARAMS="-d1 -X67"

In this example, DMA is turned on (-d1) and the mode is set to udma3 (-X67).

原创粉丝点击