hdparm

 

 

查看一般資料:

hdparm /dev/sda

/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 30401/255/63, sectors = 488397168, start = 0

更多資料:

hdparm -i /dev/sda

/dev/sda:

 Model=Hitachi HDP725025GLAT80, FwRev=GM2OA4CA, SerialNo=GE1240RS0KA9XA
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=56
 BuffType=DualPortCache, BuffSize=7174kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=488397168
 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 udma6
 AdvancedPM=yes: disabled (255) WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

 


測試速度

Usage:

hdparm -tT /dev/sda

caching of data (從 HardDisk 的 cache 讀取資料):

hdparm -t /dev/sdd

/dev/sdd:
 Timing buffered disk reads: 104 MB in  3.02 seconds =  34.40 MB/sec

buffer cache speed (without  disk access):

hdparm -T /dev/sdd

/dev/sdd:
 Timing cached reads:   4334 MB in  2.00 seconds = 2167.95 MB/sec

 


Enable Write Cache

 

查看:

hdparm -W /dev/sda

/dev/sda:
 write-caching =  1 (on)

停用:

hdparm -W0 /dev/sda

立即寫入 Cache

-f     Sync  and  flush the buffer cache for the device on exit. 

       This operation is also performed internally as part of the -t and -T timings and other options.

 


令 Disk Sleep

 

# Sleep

-y

Force an IDE drive to immediately enter the low power consumption standby mode, usually causing it to spin down.  

* 在 standby mode 依然用到 smartctl -d sat -a /dev/sdd

hdparm -y /dev/sdd

# 此 cmd 會令 Load_Cycle_Count 上升

193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       3

 * If anything access the disk, it will spin up again.

# 深層 Sleep

-Y     Force  an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to shut down completely.
         A hard or soft reset is required before the drive can be accessed again (the Linux IDE driver will automatically handle issuing a reset  if/when  needed).

# Checking

-C            # The  current  power  mode status can be checked using the -C option.

hdparm -C /dev/sdd

[1]

/dev/sdd:
 drive state is:  active/idle

[2]

/dev/sdd:
 drive state is:  standby

# Auto Sleep

-S     Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive.
         This timeout value  is  used  by  the drive  to determine how long to wait (with no disk activity) before turning off the spindle motor to save power.  
         Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker.  
         The encoding of  the  timeout  value  is somewhat peculiar.  A value of zero means "timeouts are disabled": the device will not automatically enter standby mode.

Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.  
Values from 241 to 251 specify from 1 to  11  units  of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours.  
A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours,
and the value 254 is reserved.  255 is interpreted as 21 minutes  plus  15
seconds. 

Note that some older drives may have very different interpretations of these values.

 


Save Power

 

-M     Get/set  Automatic  Acoustic Management (AAM) setting.

Most modern harddisk drives have the ability to speed down the head movements to reduce their noise output.

0 (off)
128 (quiet)
254 (fast)