LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2007, 06:19 PM   #1
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
hdparm - should have not touched it!


discovered the hdparm command yesterday and decided to play with it based on what a very reliable source said:
Code:
   1. Benchmark the hard disk, where hda is IDE 1 hard disk:
   Warning: Do NOT use the hard disk while benchmarking. It is best to
   close all other programs and leave the mouse and keyboard untouched
   until completion.

     for i in {1,2,3}; do hdparm -tT /dev/hda; done

     /dev/hda:

     Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
     Timing buffered disk reads: 64 MB in 17.72 seconds = 3.61 MB/sec

     /dev/hda:

     Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
     Timing buffered disk reads: 64 MB in 17.75 seconds = 3.61 MB/sec

     /dev/hda:

     Timing buffer-cache reads: 128 MB in 0.54 seconds =237.04 MB/sec
     Timing buffered disk reads: 64 MB in 17.70 seconds = 3.62 MB/sec

   For the buffer-cache, the average is 232.73 + 232.73 + 237.04 = 702.5 /

   3 = 234.17 MB/sec. For the buffered disk, the average is 3.61 MB/sec.
   2. Speed it up with your MaxMultSect number in "-m??":

     hdparm -a1024 -c3 -d1 -m16 -u1 -X64 /dev/hda

   3. Benchmark the hard disk again for comparing the results:

    for i in {1,2,3}; do hdparm -tT /dev/hda; done
     /dev/hda:
     Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
     Timing buffered disk reads: 64 MB in 1.11 seconds = 57.66 MB/sec

     /dev/hda:
     Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
     Timing buffered disk reads: 64 MB in 1.11 seconds = 57.66 MB/sec

     /dev/hda:
     Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
     Timing buffered disk reads: 64 MB in 1.11 seconds = 57.66 MB/sec

   It is almost 16 times faster than before. Repeat step 1 through 3 for
   extra hard disks using "/dev/hdb" and so forth. Let's see the new
   settings:

     hdparm -v /dev/hda

     /dev/hda:
      multcount    = 16 (on)
      IO_support   =  1 (32-bit with sync)
      unmaskirq    =  1 (on)
      using_dma    =  1 (on)
      keepsettings =  0 (off)
      readonly     =  0 (off)
      readahead    = 1024 (on)
      geometry     = 9964/255/63, sectors = 160086528, start = 0

trouble was, my system was already reporting able 50MB/s before I added this to the end of my /etc/rc.d/rc.M
Code:
/usr/sbin/hdparm -a1024 -c3 -d1 -m16 /dev/hda
now i get this kinda output:
Code:
root@slackware:/usr/src/linux# for i in {1,2,3}; do hdparm -tT /dev/hda; done

/dev/hda:
 Timing cached reads:   1988 MB in  2.00 seconds = 992.81 MB/sec
 Timing buffered disk reads:   14 MB in  3.44 seconds =   4.06 MB/sec

/dev/hda:
 Timing cached reads:   2040 MB in  2.00 seconds = 1018.02 MB/sec
 Timing buffered disk reads:   12 MB in  3.08 seconds =   3.89 MB/sec

/dev/hda:
 Timing cached reads:   2052 MB in  2.00 seconds = 1025.45 MB/sec
 Timing buffered disk reads:   14 MB in  3.43 seconds =   4.08 MB/sec
root@slackware:/usr/src/linux# gedit /etc/rc.d/rc.M &
[1] 9401
root@slackware:/usr/src/linux#
Code:
root@slackware:/usr/src/linux# hdparm -i /dev/hda

/dev/hda:

 Model=ST340014A, FwRev=8.54, SerialNo=3JVD5GKD
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=78165360
 IORDY=on/off, tPIO={min:240,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: ATA/ATAPI-6 T13 1410D revision 2:

 * signifies the current active mode
i tried to turn the dma on (according to what hdparm was saying):
Code:
root@slackware:/usr/src/linux# hdparm -d1 /dev/hda

/dev/hda:
 setting using_dma to 1 (on)
 HDIO_SET_DMA failed: Operation not permitted
 using_dma    =  0 (off)
but it doesnt want to seem to turn on.

the only other thing i can say is that during startup my hard disk say it has Ultra-DMA mode 5 with S.M.A.R.T. something or other. i'm going to commend out the entry in rc.M... in the meantime i am hesitant to use the -X option with hdparm.
Code:
    -X     Set  the  IDE  transfer  mode  for newer (E)IDE/ATA
              drives.  This is typically used in combination with
              -d1  when  enabling  DMA  to/from a drive on a sup*
              ported interface chipset, where -X mdma2 is used to
              select  multiword  DMA mode2 transfers and -X sdma1
              is used to select  simple  mode  1  DMA  transfers.
              With  systems which support UltraDMA burst timings,
              -X udma2 is used to select UltraDMA mode2 transfers
              (you'll  need  to  prepare the chipset for UltraDMA
              beforehand).  Apart from that, use of this flag  is
              seldom  necessary  since most/all modern IDE drives
              default to  their  fastest  PIO  transfer  mode  at
              power-on.   Fiddling with this can be both needless
              and  risky.   On  drives  which  support  alternate
              transfer  modes,  -X can be used to switch the mode
              of the drive only.  Prior to changing the  transfer
              mode,  the IDE interface should be jumpered or pro*
              grammed (see -p flag) for the new mode  setting  to
              prevent  loss  and/or corruption of data.  Use this
              with extreme  caution!   For  the  PIO  (Programmed
              Input/Output)  transfer  modes  used by Linux, this
              value is simply the desired PIO mode number plus 8.
              Thus,  a value of 09 sets PIO mode1, 10 enables PIO
              mode2,  and  11  selects  PIO  mode3.   Setting  00
              restores  the  drive's  "default"  PIO mode, and 01
              disables IORDY.  For multiword DMA, the value  used
              is the desired DMA mode number plus 32.  for Ultra*
              DMA, the value is the desired UltraDMA mode  number
              plus 64.


anybody been in this position before and what would you recommend cause 3.5 MB at the moment really sucks.

in the meantime, i am fooling around with compiling my own kernel (2.6.21.3) and may have some options left out

thanks much

- perry
 
Old 05-29-2007, 06:32 PM   #2
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Original Poster
Rep: Reputation: 30
here's the latest:

Code:
root@slackware:/home/perry# hdparm -a1024 -c3 -d1 -m16 -u1 -X64 /dev/hda

/dev/hda:
 setting fs readahead to 1024
 setting 32-bit IO_support flag to 3
 setting multcount to 16
 setting unmaskirq to 1 (on)
 setting using_dma to 1 (on)
 HDIO_SET_DMA failed: Operation not permitted
 setting xfermode to 64 (UltraDMA mode0)
 multcount    = 16 (on)
 IO_support   =  3 (32-bit w/sync)
 unmaskirq    =  1 (on)
 using_dma    =  0 (off)
 readahead    = 1024 (on)
root@slackware:/home/perry# for i in {1,2,3}; do hdparm -tT /dev/hda; done

/dev/hda:
 Timing cached reads:   2108 MB in  2.00 seconds = 1052.42 MB/sec
 Timing buffered disk reads:   14 MB in  3.30 seconds =   4.25 MB/sec

/dev/hda:
 Timing cached reads:   2104 MB in  2.00 seconds = 1051.34 MB/sec
 Timing buffered disk reads:   14 MB in  3.31 seconds =   4.23 MB/sec

/dev/hda:
 Timing cached reads:   2120 MB in  2.00 seconds = 1058.39 MB/sec
 Timing buffered disk reads:   12 MB in  3.26 seconds =   3.68 MB/sec
a problem like this kinda makes you wanna reformat the whole damn works... yah know!

- perry
 
Old 05-29-2007, 08:15 PM   #3
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Original Poster
Rep: Reputation: 30
kernel related

i rebooted under the 2.4.29 kernel and the hard disk returned to normal. apparently, i have to make sure dma is turned on in the kernel.

it's "lets learn how to use the kernel" day

- perry
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
whats touched you (2) coolb General 11 01-06-2007 03:02 PM
What's touched you.. coolb General 14 01-06-2007 06:11 AM
hdparm -g NOT= hdparm -i ---LILO hangs @ L stevewalsh Linux - General 4 07-23-2001 10:37 PM


All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration