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

Paul Gray gray at cs.uni.edu
Wed Apr 20 09:07:18 CDT 2016


On 04/20/2016 08:59 AM, 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?

First, I believe this would be easy enough to do by setting the BIOS 
boot order, or by cracking the case and swapping the connections on the 
motherboard.

But rf they aren't already in a RAID array (in which case their 
assignment wouldn't matter anyway) why not just label them?  Then the 
order won't matter.

You can ext{2,3,4} partitions with e2label:
   e2label /dev/sda1 80GROOT

You can label swap with mkswap:
   mkswap /dev/sdb5 -L 1TBSWAP

fstab, grub, etc. all make use of disk labels so that reliance on the 
BIOS alignment can be diminished.

'blkid' shows where things line up if you ever need them.

-Paul


More information about the Cialug mailing list