HDD in Linux: Difference between revisions

From miki
Jump to navigation Jump to search
(DMA)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Command-line tools ==
== Command-line tools ==
* Use <tt>hdparm</tt> to manage hdd in Linux
* Use <tt>hdparm</tt> to manage IDE hdd in Linux
% hdparm /dev/sda # print summary information on device
% hdparm /dev/hda # print summary information on device
% hdparm -l /dev/sda # print information on device
% hdparm -l /dev/hda # print information on device
% hdparm -tT /dev/hda # benchmark device performance
% hdparm -d 1 /dev/hda # set DMA for devices
* Use <tt>sdparm</tt> to manage SATA hdd in Linux. But <tt>hdparm</tt> can still be used for benchmarking.
% sdparm /dev/sda # print summary information on device
% hdparm -tT /dev/sda # benchmark device performance
% hdparm -tT /dev/sda # benchmark device performance
% hdparm -d 1 /dev/sda # set DMA for devices


== OpenSUSE ==
== OpenSUSE ==
* In OpenSUSE, DMA can also be set through ''YaST'' &rarr; ''<tt>/etc/sysconfig</tt> Editor'' &rarr; parameter <tt>DEVICES_FORCE_IDE_DMA</tt>.
* In OpenSUSE, DMA can also be set through ''YaST'' &rarr; ''<tt>/etc/sysconfig</tt> Editor'' &rarr; parameter <tt>DEVICES_FORCE_IDE_DMA</tt>.


== Troubleshooting DMA issues ==
=== Troubleshooting DMA issues ===
Switched to OpenSUSE 11 on ''Gryphon'', not sure that DMA is enabled. <tt>hdparm /dev/sda</tt> gives the following error:
Switched to OpenSUSE 11 on ''Gryphon'', not sure that DMA is enabled. <tt>hdparm /dev/sda</tt> gives the following error:
/dev/sda:
/dev/sda:
Line 25: Line 28:
<6> ata2.00: Configured for UMDA/66
<6> ata2.00: Configured for UMDA/66
<6> ata2.01: Configured for UMDA/100
<6> ata2.01: Configured for UMDA/100
* Actually hdd are now treated as SCSI-device, including IDE PATA drives like mine. Some reporting from <tt>hdparm</tt> is not correct anymore.

% sudo hdparm -v -i /dev/sda
/dev/sda:
<font color="red">IO_support = 0 (default)
16-bit)</font>
HDIO_GET_UNMASKINTR failed: Inappropriate ioctl for device
<font color="red">HDIO_GET_DMA failed: Inappropriate ioctl for device</font>
...
Model=IC35L040AVER07-0 , FwRev=ER4OA44A, SerialNo= SXPTXF49264
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=40
BuffType=DualPortCache, BuffSize=1916kB, MaxMultSect=16, MultSect=?16?
CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=80418240
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 <font color="red">*udma5</font>
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: ATA/ATAPI-5 T13 1321D revision 1: ATA/ATAPI-2,3,4,5
* signifies the current active mode

Report on IO_support (16-bit) and on HDIO_GET_DMA is wrong. However the DMA mode is indeed correctly reported as being '''udma5''' in this case. This is because SATA device (like <tt>sda</tt>...) uses a different protocol from IDE devices. DMA is always enabled by default for SATA devices. One must use '''<tt>sdparm</tt>''' to configure these devices (available as a separate package).

% sudo sdparm /dev/sda
/dev/sda: ATA IC35L040AVER07-0 ER4O
Read write error recovery mode page:
AWRE 1
ARRE 0
PER 0
Caching (SBC) mode page:
WCE 1
RCD 0
Control mode page:
SWP 0

Latest revision as of 22:42, 14 September 2008

Command-line tools

  • Use hdparm to manage IDE hdd in Linux
% hdparm /dev/hda            # print summary information on device
% hdparm -l /dev/hda         # print information on device
% hdparm -tT /dev/hda        # benchmark device performance
% hdparm -d 1 /dev/hda       # set DMA for devices
  • Use sdparm to manage SATA hdd in Linux. But hdparm can still be used for benchmarking.
% sdparm /dev/sda            # print summary information on device
% hdparm -tT /dev/sda        # benchmark device performance

OpenSUSE

  • In OpenSUSE, DMA can also be set through YaST/etc/sysconfig Editor → parameter DEVICES_FORCE_IDE_DMA.

Troubleshooting DMA issues

Switched to OpenSUSE 11 on Gryphon, not sure that DMA is enabled. hdparm /dev/sda gives the following error:

/dev/sda:
 ...
 HDIO_GET_DMA failed: Inappropriate ioctl for device
 ...

Googling for HDIO_GET_DMA failed gives:

  • Might need to add module piix' (PCI IDE/ISA Xcelerator (Intel IC)) (see here).
  • Looking into /var/log/boot.msg, it seems however that DMA is correctly set. May be hdparm is not up-to-date anymore. One day I shall investigate this...
% cat /var/log/boot.msg | egrep "dma|DMA"
...
<6> ata1.00: Configured for UMDA/100
<6> ata1.01: Configured for UMDA/100
...
<6> ata2.00: Configured for UMDA/66
<6> ata2.01: Configured for UMDA/100
  • Actually hdd are now treated as SCSI-device, including IDE PATA drives like mine. Some reporting from hdparm is not correct anymore.
% sudo hdparm -v -i /dev/sda

/dev/sda:
 IO_support    =  0 (default) 
16-bit)
 HDIO_GET_UNMASKINTR failed: Inappropriate ioctl for device
 HDIO_GET_DMA failed: Inappropriate ioctl for device

 ... 
 Model=IC35L040AVER07-0                        , FwRev=ER4OA44A, SerialNo=         SXPTXF49264
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=40
 BuffType=DualPortCache, BuffSize=1916kB, MaxMultSect=16, MultSect=?16?
 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=80418240
 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=yes: disabled (255) WriteCache=enabled
 Drive conforms to: ATA/ATAPI-5 T13 1321D revision 1:  ATA/ATAPI-2,3,4,5 

 * signifies the current active mode

Report on IO_support (16-bit) and on HDIO_GET_DMA is wrong. However the DMA mode is indeed correctly reported as being udma5 in this case. This is because SATA device (like sda...) uses a different protocol from IDE devices. DMA is always enabled by default for SATA devices. One must use sdparm to configure these devices (available as a separate package).

% sudo sdparm /dev/sda

/dev/sda: ATA       IC35L040AVER07-0  ER4O
Read write error recovery mode page:
  AWRE        1
  ARRE        0
  PER         0
Caching (SBC) mode page:
  WCE         1
  RCD         0
Control mode page:
  SWP         0