Operating System - Linux
1820882 Members
3415 Online
109628 Solutions
New Discussion юеВ

Re: finding IDE SCSI disks

 
Jagadesh
Frequent Advisor

finding IDE SCSI disks

Is there any command to display the IDE and scsi HD seperately.

Iam aware that
#fdisk -l
will display both scsi and IDE harddisk but the same is displaying all the partitions too.

Is there a seperate command to display on harddisk and not the partitions (with out using grep)

Thanks
Jagadesh
9 REPLIES 9
Alexander Chuzhoy
Honored Contributor

Re: finding IDE SCSI disks

try man on "hdparm" utility (i'm currently not on Linux OS otherwise the I would be more specific
Huc_1
Honored Contributor

Re: finding IDE SCSI disks

For scsi
As root
#cdrecord -scanbus
or
# cat /proc/scsi/scsi

For ide
As root
#for i in a b c d ; do hdparm -I /dev/hd$i ;done

only put in the require in a b c d (ex: only a if you have only hda drive)

hdparam --help
reveals a lot of options so you can tailor the above to suite your needs.

J-P
Smile I will feel the difference
Jagadesh
Frequent Advisor

Re: finding IDE SCSI disks

Is there a command to list only the attached scsi or ide disks (apart from fdisk command)?

Huc_1
Honored Contributor

Re: finding IDE SCSI disks

Not that I know !

The best I can think is to make a sript do what you want

J-P
Smile I will feel the difference
Mark Grant
Honored Contributor

Re: finding IDE SCSI disks

"dmesg | grep disk" or something like that might work for a while.
Never preceed any demonstration with anything more predictive than "watch this"
Stuart Browne
Honored Contributor

Re: finding IDE SCSI disks

If it's a redhat system, you might find something similar to this useful:

grep "^[hs]d[a-zA-Z]" /var/log/dmesg

The 'dmesg' command that Mark mentioned is available on all Linux distributions, however it's a circular buffer of which can only hold a few kb of data (16 by default). RH, by default, dumps this out right after boot-up so the boot messages get recorded successfully, and not lost when the buffer fills up.

This will only find standard drives, not those based upon some of the more advanced controllers (I'm unaware of how fibre-channel based controllers device out their nodes, and the SmartArray use /dev/cciss/ nodes).

Hopefully this will give you a start.

As far as I'm aware however, there is no tool that will successfully list all drives, as I know 'fdisk' does not ('sfdisk -l' comes close though).
One long-haired git at your service...
Mark Grant
Honored Contributor

Re: finding IDE SCSI disks

There must be a better way of doing this because "vgscan" does it. I wonder if /proc is the answer here.
Never preceed any demonstration with anything more predictive than "watch this"
Stuart Browne
Honored Contributor

Re: finding IDE SCSI disks

For SCSI drives, yes. /proc/scsi/scsi will list such devices.

There is no equivalent however for IDE devices. As far as I'm aware, they are found and maintained at bootup, spitting out messages for dmesg to capture (thus the commands I suggested).

Failing that, I'm sure someone here suggested 'cdrecord -scanbus' from the CDRecord packages. This is limited to SCSI devices once again, but using the 'ide-scsi' kernel emulation, it will allow CD's to be viewed as SCSI devices, but not block IDE hdd's.

/proc/ide/ has some semblance of a device list, but it's a bit messy (having symbolic links to internal structures). If the IDE chipset driver does it (mine here does), it might list devices in a psudo-file here.
One long-haired git at your service...
Mark Grant
Honored Contributor

Re: finding IDE SCSI disks

Ok, we seem to have scsi covered (above). Looking through /proc/ide I'm don't think it's too messy. "cat /proc/ide/ide*/hd*/media" seems to do the trick. You'd need to supply your own values for "*" if you want to do more than just count them of course.
Never preceed any demonstration with anything more predictive than "watch this"