[Cialug] Force Disk to /dev/sda, /dev/sdb, Etc?

Zachary Kotlarek zach at kotlarek.com
Wed Apr 20 17:49:10 CDT 2016


On 20 Apr 2016, at 6:59, Todd Walton wrote:

> Is there a way to force Linux to label a certain disk /dev/sda, another one
> /dev/sdb, and so on? I have two servers, each with four hard drives all of
> the same model. The two servers mirror each other in size and SCSI
> controller placement, i.e. the 80GB is on 0:0 on both, the 1TB is on 1:0 on
> both, etc.
>
> But each comes up with the drives in a different order. Is there a way to
> make them the same?


If there’s something you can use to reliably distinguish the disks that’s available before mounting (you suggest SCSI ID; UUID or other data might also work) udev is happy to call the device files whatever you want or to make symlinks if you want to keep the native names. It won’t change what the kernel or BIOS call things internally but it will work for everything that is looking for files in /dev/*. Also note that udev config is local to the OS, not the physical disk, so it’s not the right plan if you need to move the disk between systems.

Alternatively, most filesystems allow you to include a short label in the filesystem header, and tools with filesystem-level support can read those labels and use them in place of device names. These labels are stored in the filesystem so they’ll travel with the disk, but they require the related tool(s) to understand the specific filesystem; things like `mount` and `fsck` can use them but things like `pvcreate` and `mdadm` cannot. See `e2label` or `xfs_admin` or whatever the equivalent tool is for your filesystem to add/change a label on a filesystem.

	Zach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2320 bytes
Desc: S/MIME digital signature
URL: <http://cialug.org/pipermail/cialug/attachments/20160420/e0e984d4/attachment.bin>


More information about the Cialug mailing list