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

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

 



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

[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