[CentOS] Hard drives being renamed

Wed May 25 03:14:52 UTC 2016
Miguel Medalha <medalist at sapo.pt>

>> I've run into this with ZFS on Linux. The 'blkid' is useful to identify the 
>> target device and then add that to your fstab. I don't use device names >> at all anymore, too ambiguous (depending on the circumstance) in my >> opinion.

Right. And there are other ways to identify disks unequivocally. Under CentOS, for example, I find the following directories:

/dev/disk/by-id
/dev/disk/by-path
/dev/disk/by-uuid

Each one has its optimal use case.

It seems to me that in general the ideal would  be to use the WWN identifier, which now comes printed on the disk label sticker and uniquely identifies the disk, offering a clear correspondence between physical and logical disks. Under CentOS, the WWN ID of detected disks can be found under /dev/disk/by-id. WWN stands for "World Wide Name". There's a Wikipedia article about it here:

https://en.wikipedia.org/wiki/World_Wide_Name

"hdparm - I" or even "smartctl  -a" will show which /dev/sdX or whatever corresponds to which WWN or other relatively stable ID types. The advantage of WWN is that the ID won't change if you connect the disk to a different controller, for example from a SAS one to a SATA one. In one of my servers, if I unplug a SATA disk from a LSI-Avago SAS controller and I connect it to a Intel onboard SATA controller the ID changes from "scsi-idnumber" to "ata-brand-model-serialnumber" but the WWN remains constant.