Solved How drive association happens?

  • Thread starter Deleted member 43773
  • Start date
D

Deleted member 43773

Guest
Hi guys.

How the ada numbers for which SATA-port are given?
As far as I understood it, the first used SATA port becomes ada0, the second ada1 and so on.

But this seems not to be completely true for every case.

I have a system containing 4 HDDs.
When I attach another one to one of the PCI2SATA-cards, this one becomes ada0.

In IDE days there were jumpers on the drives for setting them to primary/secondary master/slave.
I thought with SATA those days were over, since there is one plug per drive only.
But anyhow something seems to overrule this.

What I want is disks once being coherent attached to SATA-ports stay reliable on their ada#.
...it just can't be I have the first 8 drives fixed, and then just adding temporarily one or two HDDs at the 9th port, all ada-numbers are jumbled...

Is there anything within SATA-drives, that may say the drive and system "you are the first lady" resp. to prevent that?

Do FreeBSD prefer PCI-card's SATA slots before motherboard's?
And if yes, how and where can I change this, if it can be changed? (I cannot boot from PCI-card's HDDs)

Any good links I can read about that stuff?

Thank you all in advance.
 
As far as I understood it, the first used SATA port becomes ada0, the second ada1 and so on.
No, the first detected drive becomes ada0.

When I attach another one to one of the PCI2SATA-cards, this one becomes ada0.
Case in point.

What I want is disks once being coherent attached to SATA-ports stay reliable on their ada#.
You don't have that guarantee. Instead use labels (see glabel(8)) to label the drives. Those labels don't change when the drive moves around.
 
Of course. The fine details, which are quickly overseen.
And if my motherborad is a bit slow, because it's old, and the new PCIe-cards are quicker, any drive attached to them is detacted before those on the mb - got it.
Thank you very much.

Okay, so I will read, experiment with, learn and use glabel(8).

Thanks. :)
Hey, one question, one answer, period.
And no village brawl, because someone mentioned fish 😁
 
I think it's the bios of your PC who numbers & renumbers. That's why we use labels.
It does.
That's why I spent hours with attaching, reboot, reconfig, reboot, re-attach, reboot and went several times through my BIOS, until finally the config suits the way I wanted it.
..and then attached one disk, and all was jumbled 😭
😂
Looking back it was stupid. But at least I learned the one thing or the other.
(Sometimes you learn more by stupid try'n'error, than just reading the solution. And at least you got the feeling you put something in it :cool:)

Thank you guys, especially SirDice, I now have a solution.
(I knew it: In FreeBSD there always is a solution. 😁 The trick is, to find it.)
 
… the first detected drive becomes ada0. …

(OT: ggb, this is why I asked the numbering question at <https://forums.freebsd.org/posts/571093>.)

… use labels (see glabel(8)) to label the drives …

Anyone: is there a glabel equivalent to the following command?

gpart modify -i 1 -l cache2-august da1

Context: <https://pastebin.com/raw/ELB7YFKC>, where (for the nth time) I had difficulties with glabel and/or its manual page.

Discussion in IRC led to a suggestion to use gpart instead of glabel.
 
I made a bunch of mistakes with ZFS and raw devices that I didn't document because labels are the best and made them go away. So many stupid problems because you add a drive or swap a PCIe slot and now nobody knows where da3 is.
 
Anyone: is there a glabel equivalent to the following command?
For simplicity I refer to glabel(8) because it can read and understand the various other types of labels. In general I usually just use the labels that are available with GPT and add the labels when I create the partitions. Rarely have to do this after the partition has already been created.

Code:
This GEOM class also provides volume label	detection for file systems.
     Those labels cannot be set	with glabel, but must be set with the appro-
     priate file system	utility, e.g. for UFS the file system label is set
     with tunefs(8).
 
This is only semi related, but is there an auto-magic (or at least clean) way to get SAS drives show up as ADA. There's a rote understanding that "ada is a HDD, and sd is a USB), so getting systems with SAS is too confusing for the lower end people. I don't really want the label to stay with the driver (ie if the drive is put into bay 2 I want it to b e ada1) so labels don't really work. Maybe this is an easy hack without breaking something?
 
This is only semi related, but is there an auto-magic (or at least clean) way to get SAS drives show up as ADA. There's a rote understanding that "ada is a HDD, and sd is a USB), so getting systems with SAS is too confusing for the lower end people. I don't really want the label to stay with the driver (ie if the drive is put into bay 2 I want it to b e ada1) so labels don't really work. Maybe this is an easy hack without breaking something?

Using external drive controllers, BIOS updates and changes, and a drive being unreachable can all change the assignment a port is given on boot and mounting by that assignment alone can lead to needing to modify a mount command to avoid mounting the wrong device. If you accept such errors and will manually stay on top of them before/when they happen, then feel free to use ada and similar labels.

You will still not have portability between different drivers that give different device entries (ex. ada, da, nda, nvd, etc.) without manual interaction. Some drivers have an option to change the label (usually for legacy reasons); refer to the desired driver's manpage for what can be done and how. Last up would be editing the relevant code to make a driver use a different name; test for conflicts to be handled appropriately or remove competing drivers.

In avoiding that if you put a drive into bay 2 then put a label saying it is bay 2, then you can refer to it by its label and port numbers changing will not cause an incorrect mount. You could also make the drive's serial number be part of, or all of, a label for similar reasoning. Similarly, moving drives to physically different bays or cloning them to a physically different device will not alter the label and you would have to go back to manually do that to keep such a labeling consistent. You could use a labeler to physically put a label on the drive to minimize mistakes if in a hurry when things go bad and another label on the door of a removable tray helps too.
 
Back
Top