Linux – scsi and ata entries for same hard drive under /dev/disk/by-id

linuxsatascsizfs

I am trying to set up a ZFS pool using 4 bare drives which I have attached to my Ubuntu system via a SATA hot swap backplane.

These are Hitachi SATA drives. When I list the contents of /dev/disk/by-id, I see two entries for each drive:

root@scorpius:/dev/disk/by-id# ls | grep Hitachi
ata-Hitachi_HDS5C3030ALA630_MJ1323YNG0ZJ7C
ata-Hitachi_HDS5C3030ALA630_MJ1323YNG1064C
ata-Hitachi_HDS5C3030ALA630_MJ1323YNG190AC
ata-Hitachi_HDS5C3030ALA630_MJ1323YNG1DGPC
scsi-SATA_Hitachi_HDS5C30_MJ1323YNG0ZJ7C
scsi-SATA_Hitachi_HDS5C30_MJ1323YNG1064C
scsi-SATA_Hitachi_HDS5C30_MJ1323YNG190AC
scsi-SATA_Hitachi_HDS5C30_MJ1323YNG1DGPC

I know these are the same drives because I wrote down the serial numbers, and all the other drives in this system are either Seagate or WD. The serial number for the first one, for example, is YNG0ZJ7C.

Why are there two entries here for each drive? More to the point, when I create my ZFS pool which one should I use; the scsi- one or the ata- one?

Best Answer

You can use either.

Much of what's displayed depends on your controller and disks. I use SAS controllers and SAS disks (with SATA SSDs, in some cases), but you're free to use whatever you wish for your zpool drive identification. The reason you see ata and SCSI is the SCSI emulation layer in Linux here. Just make sure you DON'T use basic /dev entries like /dev/sda, /dev/sdb, etc. (unless it's a virtual machine and you can control device ordering).

As you can see, I use the SCSI and ATA entries for readability, as the pool is comprised of a group of SAS disks and a SATA SSD:

[root@Davalan /dev/disk/by-id]# zpool status
  pool: vol1
 state: ONLINE
  scan: scrub repaired 0 in 1h44m with 0 errors on Sat Jul  6 13:12:06 2013
config:

        NAME                               STATE     READ WRITE CKSUM
        vol1                               ONLINE       0     0     0
          mirror-0                         ONLINE       0     0     0
            scsi-35000c5003af99fa7         ONLINE       0     0     0
            scsi-35000cca0153ec2d0         ONLINE       0     0     0
          mirror-1                         ONLINE       0     0     0
            scsi-35000cca01540e340         ONLINE       0     0     0
            scsi-35000cca01540e298         ONLINE       0     0     0
        cache
          ata-STEC_M8IOPS-50_STM000136649  ONLINE       0     0     0

errors: No known data errors

For bare drives on a controller, you have the option of using whatever shows up. Some like the WWN-only approach, but I'm not sold on it. I like a description of the disk. These are all functionally equivalent, though... Note the destinations of the symbolic links.

[root@Davalan /dev/disk]# ls -1 
by-id
by-path
by-uuid

In my case, I have the following:

[root@Davalan /dev/disk/by-id]# ll
total 0
lrwxrwxrwx 1 root root  9 May 27 15:25 ata-STEC_M8IOPS-50_STM000136649 -> ../../sdc
lrwxrwxrwx 1 root root 10 May 27 15:25 ata-STEC_M8IOPS-50_STM000136649-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 May 27 15:25 ata-STEC_M8IOPS-50_STM000136649-part9 -> ../../sdc9
lrwxrwxrwx 1 root root  9 May 27 15:25 scsi-35000c5003af99fa7 -> ../../sdd
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000c5003af99fa7-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000c5003af99fa7-part9 -> ../../sdd9
lrwxrwxrwx 1 root root  9 May 27 15:25 scsi-35000cca0153ec2d0 -> ../../sdb
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca0153ec2d0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca0153ec2d0-part9 -> ../../sdb9
lrwxrwxrwx 1 root root  9 May 27 15:25 scsi-35000cca01540e298 -> ../../sdf
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca01540e298-part1 -> ../../sdf1
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca01540e298-part9 -> ../../sdf9
lrwxrwxrwx 1 root root  9 May 27 15:25 scsi-35000cca01540e340 -> ../../sde
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca01540e340-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-35000cca01540e340-part9 -> ../../sde9
lrwxrwxrwx 1 root root  9 May 27 15:25 scsi-SATA_STEC_M8IOPS-50_STM000136649 -> ../../sdc
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-SATA_STEC_M8IOPS-50_STM000136649-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 May 27 15:25 scsi-SATA_STEC_M8IOPS-50_STM000136649-part9 -> ../../sdc9
lrwxrwxrwx 1 root root  9 May 27 15:25 wwn-0x5000a720300411f7 -> ../../sdc
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000a720300411f7-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000a720300411f7-part9 -> ../../sdc9
lrwxrwxrwx 1 root root  9 May 27 15:25 wwn-0x5000c5003af99fa7 -> ../../sdd
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000c5003af99fa7-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000c5003af99fa7-part9 -> ../../sdd9
lrwxrwxrwx 1 root root  9 May 27 15:25 wwn-0x5000cca0153ec2d0 -> ../../sdb
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca0153ec2d0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca0153ec2d0-part9 -> ../../sdb9
lrwxrwxrwx 1 root root  9 May 27 15:25 wwn-0x5000cca01540e298 -> ../../sdf
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca01540e298-part1 -> ../../sdf1
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca01540e298-part9 -> ../../sdf9
lrwxrwxrwx 1 root root  9 May 27 15:25 wwn-0x5000cca01540e340 -> ../../sde
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca01540e340-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 May 27 15:25 wwn-0x5000cca01540e340-part9 -> ../../sde9

Lots of options, but you should probably just uses the ata-Hitachi* entries because it's descriptive enough and you're using SATA drives.