<div dir="ltr"><div>></div><div>> On Fri, Jan 29, 2016 at 12:53 PM, Hajducko, Steven <<a href="mailto:Steven_Hajducko@intuit.com">Steven_Hajducko@intuit.com</a>> wrote:</div><div>> Is there a way to consistently detect the boot-drive, across multiple hardware platforms?</div><div>></div><div>> We have several different hardware types - but it remains consistent that we always want the OS installed on the first drive in boot order.  We played around with --on-bios-disk, but that doesn't always work ( it fails, for instance, on Dell R820's with the PERC RAID controller ).  We've also tried specifying /dev/disk/by-id/edd-int13_dev80, which works on the Dell's, but fails on VMs.  ( And then throw HP and it's cciss into the whole mix.. ).  /dev/sda isn't always the boot disk - this happens to us with certain RAID configs like 1 logical drive and 8 JBOD's.   The JBOD's get detected as /dev/sda-h and the RAID drive ( which is the boot drive ), ends up as /dev/sdi.</div><div>></div><div>> Just curious if anyone else has come up with a solid way to always figure out what the boot drive is.</div><div>></div><div><br></div><div>I don't have HP servers in my mix, but I have Dell servers all the way from PE2850s up to the newest R730xd's.  Additionally, we support static, DHCP and</div><div>PXE builds which seem to enumerate the disks slightly differents.  (As you say, the desired disk is not always /dev/sda).</div><div><br></div><div>By beaucoup testing, I was able to determine my first disk always had a certain pattern.</div><div><br></div><div>In my ks.cfg files, I have a %pre section where I interrogate the SCSI sub-system to find disks of the pattern I desire.</div><div><br></div><div>Here's my relevant %pre section:</div><div><br></div><div>%pre</div><div># This *definitely* works.  See %include ignoredisk discussion above.</div><div>FIRST_PERC_VOL=$(ls -1 /dev/disk/by-path/pci-*-scsi-0:[1-9]:0:0 | grep -v usb)</div><div><br></div><div>echo "ignoredisk --only-use=$FIRST_PERC_VOL" > /tmp/ignoredisk</div><div>echo "clearpart --all --initlabel --drives=$FIRST_PERC_VOL" >> /tmp/ignoredisk</div><div><br></div><div>Here is my main section (I embed my research on the various builds and various server models as comments so that I remember</div><div>why I ended up with this specific pattern).</div><div><br></div><div>## Make sure that the USB disk(s) and FC LUNs are ignored during discovery.</div><div>#  And that we use the first PERC vol as our system disk.</div><div><br></div><div># For static builds:</div><div>#   1. Virtual media (USB) detected as /dev/sda, first PERC vol as /dev/sdb.</div><div>#   2. Physical USB media detected as /dev/sda, first PERC vol as /dev/sdb.</div><div>#   3. *However*!! if both virtual media + physical USB media present,</div><div>#       virtual media detected as /dev/sda (I think), physical USB media as</div><div>#       /dev/sdb (I think) and first PERC vol as /dev/sdc.</div><div>#   4. "ignoredisk" directive no longer tolerates a "--drives=" flag with a</div><div>#       "--only-use=" flag. One or the other, not both.</div><div>#</div><div>#  Same rules apply for DHCP builds, as they're also based on virtual or</div><div>#  physical boot media.  We want to use first PERC vol (/dev/sdb for DHCP</div><div><div>#  builds).</div><div>#</div><div>#  For PXE builds, first PERC vol is /dev/sda. (Mark's boot media is loaded</div><div>#  into mem I guess.)</div><div>#</div><div># YUCK!!! Instead of considering all those ugly cases --</div><div>#</div><div># Consistently, the 1st PERC vol seems to be enumerated as [0:2:0:0] on</div><div># M620s and R620s.  Here's example output from lsscsi -g:</div><div>#</div><div># #lsscsi -g</div><div>#  [0:0:32:0]   enclosu DP       BACKPLANE        1.07  -          /dev/sg0</div><div>#  [0:2:0:0]    disk    DELL     PERC 6/i         1.22  /dev/sda   /dev/sg1</div><div>#  [0:2:1:0]    disk    DELL     PERC 6/i         1.22  /dev/sdb   /dev/sg2</div><div>#</div><div># ks.cfg now allows /dev/disk/by-path/ and /dev/disk/by-id shell-like globs.</div><div># See <a href="http://fedoraproject.org/wiki/Anaconda/Kickstart">http://fedoraproject.org/wiki/Anaconda/Kickstart</a>, Special Notes for</div><div>#     Referring to Disks.</div><div>#</div><div># So /dev/disk/by-path/pci-*-usb-* captures all USB media,</div><div>#    /dev/disk/by-path/pci-*-scsi-* captures all PERC vols,</div><div>#    /dev/disk/by-path/pci-*-scsi-0:2:0:0 captures first PERC vol (on a M620),</div><div>#    /dev/disk/by-path/pci-*-fc-* captures all FC LUNs.</div><div><br></div><div># bootloader --driveorder</div><div>#</div><div># Specifies which drive is first in the BIOS boot order. For example:</div><div># bootloader --driveorder=sda,hda</div><div>#</div><div># When we boot OS, the PERC vols are first in BIOS boot order.</div><div>bootloader --location=mbr --driveorder=/dev/disk/by-path/pci-*-scsi-*</div><div><br></div><div># The boot media on a M710HD enumerates disk as so:</div><div>#    /dev/disk/by-path/pci-0000:00:1d.7-usb-0:3:1.0-scsi-0:0:0:0 ???</div><div>#    /dev/disk/by-path/pci-0000:00:1d.7-usb-0:3:1.1-scsi-0:0:0:0 ???</div><div>#    /dev/disk/by-path/pci-0000:00:1d.7-usb-0:3:1.2-scsi-0:0:0:0 USB key</div><div>#    /dev/disk/by-path/pci-0000:01:00.0-scsi-0:1:0:0 first PERC volume</div><div>#</div><div># Would the following line work to lay down partitions only on 1st PERC</div><div># volume?  Would this work on all server models?</div><div>#ignoredisk --only-use=/dev/disk/by-path/pci-*-scsi-0:[1-9]:0:0</div><div><br></div><div># Thus, would the following line remove all partitions, but only from 1st PERC</div><div># vol?  For all server models?</div><div>#clearpart --all --initlabel --drives=/dev/disk/by-path/pci-*-scsi-0:[1-9]:0:0</div></div><div><br></div><div><div># This *definitely* works.  See %pre section.</div><div>%include /tmp/ignoredisk</div><div><br></div><div>Also one more comment.  Long ago, there was a particular Dell mode (R710).  Its</div><div>low-end PERC controller was forever flip-flopping the disks from one boot to the next.</div><div><br></div><div>That is, after OS is installed on the disk and server rebooted, this first</div><div>PERC vol was no longer /dev/sda, but now /dev/sdb.  I believe some later rev of</div><div>the PERC firmware eventually solved this problem.</div><div><br></div><div>But in the meantime we found that this killed some of our builds, not others.</div><div><br></div><div>We found if we created all our OS partitions as LVMs, then they'd be discovered and</div><div>mounted, regardless of whether your boot disk was /dev/sda, sdb, or sdc</div><div>today.</div><div><br></div><div>This works because grub identifies its boot partition by SCSI ID -- for instance hd(0,0).</div><div>Once grub loads the boot vmlinuz/initramfs, the boot kernel does a lvscan.  And it finds</div><div>your LVMs wherever they reside today.</div><div><br></div><div>Moral of this story: It's good to create your OS filesystems as LVMs.  For this and</div><div>other reasons.</div><div><br></div><div>Spike</div></div><div><br></div></div>