linux poison RSS
linux poison Email

Speeding up Linux Using hdparm - Optimize Hard Disk

hdparm is a command line utility for the Linux operating systems to set and view SATA and IDE hard disk hardware parameters. It can set parameters such as drive caches, sleep mode, power management, acoustic management, and DMA settings.

Changing hardware parameters from suboptimal conservative defaults to their optimal settings can improve performance greatly. For example, turning on DMA can in some instances double or triple data throughput.

Here's how to put hdparm to use on your computer. Unlike recent tips, for this one you start by logging in as root. Type: $ su

Type the root password at the prompt. Then type: # hdparm -tT /dev/sda
Above commands should display a screen something this:

    Timing cached reads:   1174 MB in  2.00 seconds = 587.03 MB/sec
    Timing buffered disk reads:  174 MB in  3.01 seconds =  57.81 MB/sec

This performance isn't bad, but could be improved by tweaking some settings. Before you jump right in though, be sure to take some precautions. Some tweaks can cause problems, and may even make your hard disk unstable. First check the current settings: # hdparm /dev/sda

This will return something like:
multcount= 16 (on)
IO_support= 0 (default 16-bit)
unmaskirq= 0 (off)
using_dma= 1 (on)
keepsettings= 0 (off)
readonly= 0 (off)
readahead= 256 (on)
geometry= 65535/16/63, sectors = 60040544256, start = 0
Write down the parameters and their values, so you can set them back to the old values if needed.
To find additional info about your hard disk, use this command: # hdparm -i /dev/sda
This set of sample results from the above command shows just how detailed the information will be:

    Model=WDC WD800BD-22LRA0, FwRev=06.01D06, SerialNo=     WD-WMAM9P258947
     Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
     RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=65
     BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=?1?
     CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
     IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
     PIO modes:  pio0 pio3 pio4
     DMA modes:  mdma0 mdma1 mdma2
     UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
     AdvancedPM=no WriteCache=enabled
     Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

    * signifies the current active mode

These are possible settings for your hard disk, and the tweaks you might make.
As an example, to set 32-bit I/O support flag to 3, multicount to 16 and DMA (Direct Memory Access) to 1 (= on), you give the following command from root:  # hdparm -c3 -m16 -d1 /dev/sda

Enabling DMA can in some cases lead to serious instability. To disable DMA:  # hdparm -d0 /dev/sda
After making changes, check to see if performance has improved: # hdparm -tT /dev/hda


3 comments:

blink4blog said...

these are the feedback from hdparm:

/dev/sda:
setting 32-bit IO_support flag to 3
HDIO_SET_32BIT failed: Invalid argument
setting multcount to 16
HDIO_SET_MULTCOUNT failed: Inappropriate ioctl for device
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Inappropriate ioctl for device
HDIO_GET_MULTCOUNT failed: Inappropriate ioctl for device
IO_support = 0 (default)
HDIO_GET_DMA failed: Inappropriate ioctl for device

does it means my hard disk is not supported?

DevOps said...

Yea, looks like you hard disk is not supported.

Branded USB Sticks said...

Well i also feel that there is some problem with your pc. Your hard disk or RAM is not supported. You need to investigate the problem. I personally feel that there is some problem with your hard drive. You need to change it. It 'll work for you.

Post a Comment

Related Posts with Thumbnails