Drive Symbols

From unRAID
Jump to: navigation, search
Note1: this is a work-in-progress, still VERY incomplete!
Note2: this will need to be constantly updated, after future kernel releases and additional controllers

We often get questions about figuring out which drive is being referred to when a drive error occurs, because different Linux functions refer to drives in a number of different ways. This is an attempt to help sort out all of the drive symbols, and hopefully provide methods of determining which drive a particular symbol refers to.

I wish this were easier, but it's not! Long ago, I helped Brian with a feature in the MyMain page of UnMenu, that would identify all of the symbols (eg. scsi0, sd 0:0:0:0, scsi 0:0:0:0, ata1, ata1.00, sda, md1) associated with a drive, and locate every related syslog line that contained them. But even then, it was not perfect, maybe 99.8% correct. And the exceptions to the rules have gotten much worse since then, with simultaneous assignment of symbols by differing driver modules, resulting very often in mixed up order. It's partly trial and error now, partly simple logic, sometimes just working backwards from the very last symbol assignments, and sometimes from clues within the error messages themselves.

Caution #1, the fact that some of the scsi numbers, ata numbers, and Disk numbers are equal is generally coincidental!
Caution #2, scsi and ata number assignments may change with EACH boot!

Long ago, it was relatively simple. The kernel would identify the flash drive, assign it to scsi0, and since USB drives don't get ata symbols, the ata and scsi assignments would very often line up. So then the motherboard ports would be identified and set up after the flash drive, which would result in the flash drive being associated with scsi0, scsi0:0:0:0, sd0:0:0:0, and sda; the first hard drive would be associated with the symbols scsi1, scsi1:0:0:0, sd1:0:0:0, ata1, ata1.00, and sdb; and the sixth attached drive would be associated with scsi6, scsi6:0:0:0, sd6:0:0:0, ata6, ata6.00, and sdg. If there were no other disk controllers, it was really easy to understand, and to follow in the syslog. Even then though, occasionally the USB flash drive would be identified AFTER the motherboard ports, which resulted in the flash drive possibly being assigned scsi6, and the first drive being scsi0 and ata1, the sixth drive scsi5 and ata6, all drive symbols off by one between the ata and scsi symbol numbers.

Since then, it has gotten much more complex, with considerable inconsistency in the order of drive identification and setup, and in the way each driver module handled acquiring the symbol assignments.

Here are the current rules (to the best of my knowledge):

  1. The ata symbol numbers begin with one (eg. ata1, ata2, ata13, etc). With a single number, they represent a single 'channel', with one or more ports. When it includes a period and 2 digits (eg. ata1.00, ata14.01, etc), then it represents a device that will use that channel. Most of the time, there is only one port associated, so the attached drive on ata5 would be ata5.00. But for IDE emulating controllers or Port Multipliers or certain other controllers, there may be multiple ata device assignments per ata channel, whether occupied or empty. An IDE type controller might have ata6.00 and ata6.01 using the ata6 channel. A port multiplier might have ata8.00, ata8.01, ata8.02, ata8.03, ata8.04, and ata8.05 using the ata8 channel. And there is another card with 8 ports (a PCI-X card?) that would use ata#.00 through ata#.07 on the ata# channel.
  2. The scsi symbol numbers begin with zero (eg. scsi0, scsi1, scsi12, etc). With a single number, they somewhat loosely represent a single 'channel' or family of one or more ports. When it includes 3 colons and 3 digits (eg. scsi1:0:0:0, scsi14:0:2:0, etc), then it represents a device that will use that 'channel'. The 2 forms of scsi symbols, scsi#:0:0:0 and sd#:0:0:0, are essentially equivalent, used interchangeably, and I have yet to see a distinction. Some kernel functions use the scsi_ form, and others use the sd_ form. Some controllers assign one scsi 'channel' per port (eg. 8 channels for an 8 port card), so their first port could be scsi6:0:0:0 on scsi6, and their second port could be scsi7:0:0:0 on scsi7. Other controllers use only one scsi 'channel' with multiple scsi sub-assignments on that one channel (eg. 1 channel for an 8 port card). So their first port could be scsi6:0:0:0 on scsi6, and their second port could be scsi6:0:1:0 on scsi6.
  3. USB drives get scsi symbols, but not ata symbols (eg. scsi2, scsi2:0:0:0, and sd2:0:0:0). A USB drive gets one scsi symbol assignment, usually pretty quickly but sometimes later, rarely the last to be assigned.
  4. The symbol assignments (especially the ata symbols) for many controllers may be intermixed with other controllers assignments, since they are happening simultaneously. And on the next boot, the assignments may be quite different. This is the one item that makes syslog analysis of drive issues the most challenging!
  5. The ahci module gets one scsi symbol and one ata symbol per port. It is used by most motherboard SATA ports, the JMB SATA ports, and others. They usually get the scsi assignments very early, especially motherboard ports (often the first). They delay a little before acquiring the associated ata symbols, so sometimes another controller will beat them to the next ata symbols, making it somewhat harder when trying to analyze a syslog! The ahci module announces itself with quite a bit of info for each supported controller, including the number of ports and how fast they are (eg. "6 ports 3 Gbps"), and the features supported for each controller (eg. "64bit ncq sntf led clo pio slum part ccc ems").
  6. The mvsas module (used by mvsas-based controller cards) announces itself very early (often first), and acquires one scsi assignment right then, for a single controller. It usually waits awhile before using the assignment however, well after other controllers, and then begins the identification of attached drives, using scsi sub-assignments, and then acquiring ata symbols for each. The mvsas module often gets scsi0, but then assigns, for example to a 4 port card, the individual drive symbols scsi0:0:0:0, scsi0:0:1:0, scsi0:0:2:0, and scsi0:0:3:0 (each also referred elsewhere as the equivalent symbols sd0:0:0:0, sd0:0:1:0, sd0:0:2:0, and sd0:0:3:0). If there were another mvsas-based 2 SATA port card, it might pop up later with the assignment of scsi9, and would later assign to its 2 ports/drives scsi9:0:0:0 and scsi9:0:1:0 (equal to sd9:0:0:0 and sd9:0:1:0). There is another delay before it acquires ata symbols for each port (empty or occupied).
  7. The ata_piix module (used by IDE emulating SATA ports on a motherboard, whether the main ports or an auxiliary onboard controller) works like IDE channels, and divides the ports into pairs, assigning one scsi and ata symbol for each 2 ports. For example, it might get scsi3 and ata4, so then ata4.00 and ata4.01 for the 2 ports. In general, if you see the ata_piix module in use in the syslog, you should check to see if the BIOS settings can be changed to use AHCI instead.
  8. sata_nv - motherboard ports on an nForce-based board...
  9. sata_mv - Marvell chipset ports...
  10. sas2lp?...
  11. sata_sil - if 2 ports: SiI3112; if 4 ports: SiI3114; could be onboard or addon card controller...
  12. sata_sil24 - if 2 ports: SiI3132; if 4 ports: SiI3124; could be onboard or addon card controller...
  13. sata_promise? - SATA ports on Promise card...
  14. others?...
  15. IDE channels - hda, hdb, etc; piix; fixed hd# assignment; IDE0, IDE1, IDE2, etc...
  16. sda, sdb, etc - dynamic sd# assignment...
  17. md1, md2, etc...
  18. clues within and adjacent to the exception handler series of syslog lines...

...

Examples

Here is an easy example, nothing out of order or intermingled, wish they were all like this! It even has one error and one minor issue for us.

Mar 13 12:34:35 Media kernel: ahci 0000:00:1f.2: version 3.0
Mar 13 12:34:35 Media kernel: ahci 0000:00:1f.2: irq 46 for MSI/MSI-X
Mar 13 12:34:35 Media kernel: ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 6 ports 3 Gbps 0x3f impl SATA mode
Mar 13 12:34:35 Media kernel: ahci 0000:00:1f.2: flags: 64bit ncq sntf led clo pio slum part ccc ems 
Mar 13 12:34:35 Media kernel: ahci 0000:00:1f.2: setting latency timer to 64
...[snipped]...
Mar 13 12:34:35 Media kernel: jmicron 0000:06:00.1: IDE controller (0x197b:0x2363 rev 0x02)
Mar 13 12:34:35 Media kernel: jmicron 0000:06:00.1: 100%% native mode on irq 18
Mar 13 12:34:35 Media kernel:     ide0: BM-DMA at 0x9b00-0x9b07
Mar 13 12:34:35 Media kernel:     ide1: BM-DMA at 0x9b08-0x9b0f
Mar 13 12:34:35 Media kernel: Probing IDE interface ide0...
Mar 13 12:34:35 Media kernel: sata_sil24 0000:04:00.0: version 1.1
...[snipped]...
Mar 13 12:34:35 Media kernel: scsi0 : sata_sil24
Mar 13 12:34:35 Media kernel: scsi1 : sata_sil24
Mar 13 12:34:35 Media kernel: ata1: SATA max UDMA/100 host m128@0xfdcff000 port 0xfdcf8000 irq 19
Mar 13 12:34:35 Media kernel: ata2: SATA max UDMA/100 host m128@0xfdcff000 port 0xfdcfa000 irq 19
Mar 13 12:34:35 Media kernel: scsi2 : ahci
Mar 13 12:34:35 Media kernel: scsi3 : ahci
Mar 13 12:34:35 Media kernel: scsi4 : ahci
Mar 13 12:34:35 Media kernel: scsi5 : ahci
Mar 13 12:34:35 Media kernel: scsi6 : ahci
Mar 13 12:34:35 Media kernel: scsi7 : ahci
Mar 13 12:34:35 Media kernel: ata3: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd100 irq 46
Mar 13 12:34:35 Media kernel: ata4: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd180 irq 46
Mar 13 12:34:35 Media kernel: ata5: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd200 irq 46
Mar 13 12:34:35 Media kernel: ata6: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd280 irq 46
Mar 13 12:34:35 Media kernel: ata7: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd300 irq 46
Mar 13 12:34:35 Media kernel: ata8: SATA max UDMA/133 abar m2048@0xfdffd000 port 0xfdffd380 irq 46
Mar 13 12:34:35 Media kernel: usb 2-2: new high-speed USB device number 2 using ehci_hcd
Mar 13 12:34:35 Media kernel: scsi8 : usb-storage 2-2:1.0
Mar 13 12:34:35 Media kernel: ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Mar 13 12:34:35 Media kernel: ata8: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Mar 13 12:34:35 Media kernel: ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Mar 13 12:34:35 Media kernel: ata7: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Mar 13 12:34:35 Media kernel: ata4.00: ATA-8: Hitachi HDS722020ALA330, JKAOA3EA, max UDMA/133
Mar 13 12:34:35 Media kernel: ata4.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
Mar 13 12:34:35 Media kernel: ata7.00: ATA-8: Hitachi HDS5C3020ALA632, ML6OAA10, max UDMA/133
Mar 13 12:34:35 Media kernel: ata7.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
Mar 13 12:34:35 Media kernel: ata7.00: failed to IDENTIFY (I/O error, err_mask=0x100)
Mar 13 12:34:35 Media kernel: ata7.00: revalidation failed (errno=-5)
Mar 13 12:34:35 Media kernel: Probing IDE interface ide1...
Mar 13 12:34:35 Media kernel: ide0 at 0x9f00-0x9f07,0x9e02 on irq 18
Mar 13 12:34:35 Media kernel: ide1 at 0x9d00-0x9d07,0x9c02 on irq 18
Mar 13 12:34:35 Media kernel: ahci 0000:06:00.0: AHCI 0001.0000 32 slots 2 ports 3 Gbps 0x3 impl SATA mode
Mar 13 12:34:35 Media kernel: ahci 0000:06:00.0: flags: 64bit ncq pm led clo pmp pio slum part 
Mar 13 12:34:35 Media kernel: scsi9 : ahci
Mar 13 12:34:35 Media kernel: scsi10 : ahci
Mar 13 12:34:35 Media kernel: ata9: SATA max UDMA/133 abar m8192@0xfd8fe000 port 0xfd8fe100 irq 17
Mar 13 12:34:35 Media kernel: ata10: SATA max UDMA/133 abar m8192@0xfd8fe000 port 0xfd8fe180 irq 17
Mar 13 12:34:35 Media kernel: scsi 8:0:0:0: Direct-Access     Verbatim STORE N GO       1.00 PQ: 0 ANSI: 2
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] 7831552 512-byte logical blocks: (4.00 GB/3.73 GiB)
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Write Protect is off
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Mode Sense: 03 00 00 00
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] No Caching mode page present
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Assuming drive cache: write through
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: Attached scsi generic sg0 type 0
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] No Caching mode page present
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Assuming drive cache: write through
Mar 13 12:34:35 Media kernel:  sda: sda1
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] No Caching mode page present
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Assuming drive cache: write through
Mar 13 12:34:35 Media kernel: sd 8:0:0:0: [sda] Attached SCSI removable disk
Mar 13 12:34:35 Media kernel: ata10: SATA link down (SStatus 0 SControl 300)
Mar 13 12:34:35 Media kernel: ata9: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
Mar 13 12:34:35 Media kernel: ata9.00: ATA-9: WDC WD20EZRX-00DC0B0, 80.00A80, max UDMA/133
Mar 13 12:34:35 Media kernel: ata9.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
Mar 13 12:34:35 Media kernel: ata9.00: configured for UDMA/133
...

You can see that an ahci type controller announces itself, then a jmicron PATA controller, then a sata_sil24 controller, then farther down a USB drive, then another ahci type controller. The sata_sil24 controller is the first to grab scsi assignments, 2 of them, then quickly follows that up by grabbing 2 ata symbols. The ahci controller grabs 6 scsi symbols, then 6 ata symbols, then the usb_storage module grabs scsi8 for the flash drive (but no ata symbol). The jmicron controller does not appear to find any PATA drives. Then the second ahci controller grabs scsi9, scsi10, ata9, and ata10. Believe me, it's not usually this easy! By the way, we know from experience that the 6 ahci ports grabbed early are the 6 onboard SATA ports.

The ata channels ata4, ata8, ata3, and ata7 then report that they have successfully linked up SATA devices at 3.0Gbps, meaning they have SATA drives connected. Most controller modules, but not all, will report 'SATA link up' to a drive or 'SATA link down' (meaning no drive connected) for all ata channels. Then ata4 reports identity info on the drive ata4.00, its model, firmware, size, speed, and other parameters. Then ata7 appears to do the same but quickly reports trouble, incomplete identity info and a failed revalidation. This immediately tells us there are serious communications problems between the controller and this drive! We don't know the specifics of why it is failing (and may never know), but we would know from this to examine the rest of the syslog for more errors related to this drive.

The flash drive is the first to be fully setup, on scsi8 as scsi 8:0:0:0 (or the equivalent sd 8:0:0:0). We can easily see that it is now associated with the first drive symbol sda. Once configured, the drive sda is examined and one partition is found, so that partition is associated with the symbol sda1 ("kernel: sda: sda1").

One minor issue shows up then, with the statement "ata9: SATA link up 1.5". Above, we can see that the controller reported 3.0 Gbps support, and we know this drive supports 3.0 Gbps, so this absolutely should have been a SATA link up of 3.0 Gbps, not 1.5 Gbps. This may not seem that important, but it's something to monitor, because it's not right. Unfortunately, there is no further info as to why it could not negotiate a SATA connection at 3.0 Gbps.

Hopefully this easy example helps you to understand the gist of how this symbol assignment and drive setup process works, and how you can use it when diagnosing a drive error. For example, if we later saw errors concerning ata4, then we know we could look above and see that it was the second of the group of 6, so ata4 is associated with scsi3, and it is associated with the second SATA port on the motherboard.