I need to find out if a disk is IDE or SATA (or anything else, maybe). I know that the device is /dev/sda, so I think it's SATA, but I don't know if I can be sure just by the name. I tried looking at dmesg and it always says "SCSI", but I'm sure it's not...
any ideas?
Interesting question.
dmesg
should have something like this if it's a SATA drive:I then grep'ed the
dmesg
output for "ata3" and found the serial number:which could then be looked up
smartctl
orhdparm -i /dev/<your disk(s)>
to match serial with device.I'm sure someone with l33t shell scripting skillz could do this all up on one line, but this should be pretty solid. If any doubts, I'd check the serial number against the manufacturer's Website as Madhatter suggested.
I ran the same
dmesg | grep -i SATA
on Ubuntu running on a VMware virtual machine (which treats the virtual drives as SCSI) and a server with SCSI disks; both returned nothing.One pretty reliable method is to use lshw to lookup the model number and then to lookup the model number on Google to see what type of device it is. This method doesn't work if the drive is in a USB enclosure, some USB controllers hide the HD info from you.
So for this system you would do a search on ST31500341AS. and find that it is a 1.5TB SATA drive.
If it were IDE, it would very likely show up as /dev/hda. You could try
smartctl -a /dev/sda
which will produce a lot of information including manufacturer and model number; cross-referencing that on the manufacturer's website is usually fairly simple.MadHatter is right in that the designation difference would be /dev/hdx versus /dev/sdx. But the surest way is to open the case and look at the cable. You don't necessarily need to shut off the machine to do that, depending on the system you're looking at and what kind of tangled nest of cables you have around the case.
If the system can be rebooted you could use the Ultimate Boot CD to run a hard disk diagnostic, they normally identify the drive type and model. Even the BIOS might tell you at reboot what kind of drive it is.
Look at the cables/connectors or look at dmesg.
You cannot rely on /dev/hd for PATA drives. For modern systems all PATA/SATA drives will show up as /dev/sd because the new ATA layer uses the sd prefix. You will only see /dev/hd if your OS uses the old deprecated ATA drivers.
I realize this post is old (Linux now lumps IDE/PATA drives in with /dev/sd?) but the easiest way to do this nowadays is
Which gives the following output for a system with one SATA and one PATA drive:
If you run
sudo hdparm -I /dev/sdX | grep Gen
, it should give you output something like this on a SATA drive. Not got IDE or SCSI I can test with, but should be different on them, as SATA has different speeds.` sudo hdparm -I /dev/sda | grep Gen