Re: how do I detect the HDD's on the system?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel
wrote:
The way I detect whether it's scsi/sas or ide is as follows. This assumes
that if the disks are scsi or sas, then they have a hardware RAID (which
has already been configured). If IDE create the software RAID. As far as
number of drives/multiple formats, you'll have to do some additional logic
based on what it finds. Hope it helps some.

%pre
if [ "`cat /proc/ide/hda/media`" = "disk" ]
then
echo "clearpart --all --initlabel" >/tmp/part-include
echo "part raid.10 --size=100 --ondisk=hda --asprimary" >>/tmp/part-include
echo "part raid.11 --size=100 --ondisk=hdb --asprimary" >>/tmp/part-include
echo "part raid.20 --size 5120 --ondisk=hda --asprimary"
/tmp/part-include
echo "part raid.21 --size 5120 --ondisk=hdb --asprimary"
/tmp/part-include
echo "part raid.30 --size 5120 --ondisk=hda --asprimary"
/tmp/part-include
echo "part raid.31 --size 5120 --ondisk=hdb --asprimary"
/tmp/part-include
echo "part raid.40 --size 2048 --ondisk=hda" >>/tmp/part-include
echo "part raid.41 --size 2048 --ondisk=hdb" >>/tmp/part-include
echo "part raid.50 --size 10240 --ondisk=hda" >>/tmp/part-include
echo "part raid.51 --size 10240 --ondisk=hdb" >>/tmp/part-include
echo "raid / --fstype ext3 --device=md0 --level=RAID1 raid.20 raid.21"
/tmp/part-include
echo "raid /boot --fstype ext3 --device=md1 --level=RAID1 raid.10 raid.11"
/tmp/part-include
echo "raid /home --fstype ext3 --device=md2 --level=RAID1 raid.30 raid.31"
/tmp/part-include
echo "raid swap --fstype swap --device=md4 --level=RAID1 raid.40 raid.41"
/tmp/part-include
echo "raid /var --fstype ext3 --device=md3 --level=RAID1 raid.50 raid.51"
/tmp/part-include
else
echo "clearpart --all --initlabel" >/tmp/part-include
echo "part /boot --size 100 --fstype ext3 --asprimary" >>/tmp/part-include
echo "part swap --size 2048 --fstype swap" >>/tmp/part-include
echo "part / --size 5120 --fstype ext3 --asprimary" >>/tmp/part-include
echo "part /home --size 5120 --fstype ext3 --asprimary" >>/tmp/part-include
echo "part /var --size 10240 --fstype ext3" >>/tmp/part-include
fi

-Dan


On Thu, 28 Feb 2008 22:26:06 +0200, Rudi Ahlers <Rudi@xxxxxxxxxxx> wrote:
Hi

I want to setup different software RAID levels, according to the number
& type of drives in the actual system. My problem is, I often have
systems with mixed IDE & SATA drives.

I found the following website,

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/s1-kickstart2-preinstallconfig.html
which has some neat tricks on detecting the IDE drives, but the same
techniques doesn't apply for SATA drives ( I don't even know how SAS /
SCSI drives operate on Linux, since I haven't worked with them yet)

The basis of the script is as follows:


for file in /proc/ide/h*
do
  mymedia=`cat $file/media`
  if [ $mymedia == "disk" ] ; then
      hds="$hds `basename $file`"
  fi
done

set $hds
numhd=`echo $#`

drive1=`echo $hds | cut -d' ' -f1`
drive2=`echo $hds | cut -d' ' -f2`

It doesn't indicate which drive is first in the list, which could be a
problem is the cdrom is on HDA for example (mine is, due to the 2U case
layout and how the IDE cable runs)

With SATA (which uses scsi emulation), the process is different. There's
no /media folder in /proc/scsi/ - only a scsi file, which lists all the
devices:

 cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST3250410AS      Rev: 3.AA
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST3250410AS      Rev: 3.AA
  Type:   Direct-Access                    ANSI SCSI revision: 05


dmesg | grep sd
SCSI device sda: 488395055 512-byte hdwr sectors (250058 MB)
SCSI device sda: drive cache: write back
SCSI device sda: 488395055 512-byte hdwr sectors (250058 MB)
SCSI device sda: drive cache: write back
 sda: sda1 sda2
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
SCSI device sdb: drive cache: write back
SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
SCSI device sdb: drive cache: write back
 sdb: sdb1 sdb2



So, how does the system know that scsi0 = sata1 ?

I'd like to find this out, cause it will make the RAID setup much easier
for mixed systems

--

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other
technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting
stugg

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list
Hi Daniel

Thank you for the info, but it doesn't really help me. You also check to see if the work "disk" appears in the /proc/ide/*/media files.

My problem is, I want this to work for scenarios where I use software RAID. What makes it trickey, is that one some mobo's the SATA HDD's would be the first few drives, and then the IDE's, meaning that I may not necessarily have hda & hdb. I currently have hddc & hdd, so with this particular setup kickstart fails, since it wants to setup hda.

My SATA HDD's work as sda, sdb, sdc, etc. As far as I can tell, that sequence will always be there, which could make it easier.

--

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux