# LSISAS2116 disk device names



## AndyUKG (Jul 22, 2013)

Hi,

  I've recently built a system with a LSI SAS 9201-16i (LSISAS2116 chipset). Today I replaced two of the drives and I see something I didn't expect. From the LSI setup screen (prior to booting the OS) I see all the drives numbered from 0 upwards as they are physically connected to the server. However from within FreeBSD from camcontrol the two new drives which are replacements for the drives in slot 0 and 1 show as being targets 12 and 13 (there are 12 disks in total)


```
# camcontrol devlist -v
scbus0 on mps0 bus 0:
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 2 lun 0 (pass0,da0)
<ATA WDC WD30EZRX-00D 0A80>        at scbus0 target 3 lun 0 (pass1,da1)
<ATA WDC WD30EZRX-00D 0A80>        at scbus0 target 4 lun 0 (pass2,da2)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 5 lun 0 (pass3,da3)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 6 lun 0 (pass4,da4)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 7 lun 0 (pass5,da5)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 8 lun 0 (pass6,da6)
<ATA WDC WD30EZRX-00D 0A80>        at scbus0 target 9 lun 0 (pass7,da7)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 10 lun 0 (pass8,da8)
<ATA WDC WD30EZRX-00A 0A80>        at scbus0 target 11 lun 0 (pass9,da9)
<ATA ST3160318AS CC38>             at scbus0 target 12 lun 0 (pass10,da10)
<ATA ST3160318AS CC38>             at scbus0 target 13 lun 0 (pass11,da11)
```

As can be seen this results in the device names for the disks in slot 0 and 1 being da10 and da11 rather than da0 and da1 as I would expect. I could start using device.hints to remap these but it seems to me every time a disk is replaced its target will change which would require messing with device.hints again.

I'd really rather the target, and therefore the disk device number, was representative of how the disks are physically connected. Does anyone know why I have this issue and what the cause is?

Thanks in advance! Andy.


----------



## phoenix (Jul 23, 2013)

Either use device.hints to wire down the targets to specific slots, or label the individual disks (via glabel(8)) or individual partitions on the disks (via gpart(8)).

Personally, I find labelling the drives works better.


----------



## AndyUKG (Jul 23, 2013)

Thanks for the reply.

I personally don't like labelling as it seems unclean in the implementation to me that it allows for accidental corruption of actual data on the drive. That and old habits.

I also don't like the device.hints option for the resons mentioned, it would appear that if for example I replaced the disk currently at target 2 the new disk would show up at target 14. Given from the LSI BIOS configuration screen all disks are ordered as they are connected I assume this must be a driver level issue. That is the driver maintains some list of devices and won't reuse a target number previously occupied by another. It seems very odd to me.

Perhaps the best place to ask about the driver is the lists...


----------



## wblock@ (Jul 23, 2013)

AndyUKG said:
			
		

> Thanks for the reply.
> 
> I personally don't like labelling as it seems unclean in the implementation to me that it allows for accidental corruption of actual data on the drive.



It does not, or maybe I misunderstand.  Put a label on a disk and it creates a new device.  Use that device, say /dev/label/disk0.  It is one block smaller than the disk, and the label is outside of it.

There was bad advice given out on this previously, even in the Handbook.  A quick hack to avoid repartitioning, it meant well but was a mistake.

GPT labels are even better, taking no extra space, although there is the overhead of primary and backup GPT tables.


----------



## AndyUKG (Jul 23, 2013)

Ok, thanks @wblock@, that's interesting to know. I had in mind info from the handbook and other source, "be careful when labelling to avoid data loss" type things that really turned me off the idea. Plus I'm a bit of a dinosaur when it comes to these things, I'm really happy with device names, what I'd really like is Solaris style disk device names 

But I'd still like my devices to show in camcontrol in the order they are actually attached 

cheers Andy.


----------

