How to find out what disk drives are installed in a Ubuntu server

I have remote access (including root access) to a Ubuntu 9 server, but can't inspect it physically or reboot it.

I want to find out the manufacturer and model of the hard disks installed in the server and how they are connected (SATA / IDE, which version). Is there a command line way of doing this? (I can install additional software if necessary)


Solution 1:

If you do an fdisk -l as root it should list the drives and partitions like below:

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00044ff8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         994     7977984   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             994        1045      407553    5  Extended
/dev/sda5             994        1045      407552   82  Linux swap / Solaris

/dev/sda is the drive and each number is a partition.

So if you see hda or sda or sdb... this is what you use in the smartctl command.

you can get smartctl with sudo apt-get install smartmontools

Since mine is sda...

run sudo smartctl -i /dev/sda

=== START OF INFORMATION SECTION ===
Device Model:     VBOX HARDDISK
Serial Number:    VB3fd813ad-aa9ce411
Firmware Version: 1.0
User Capacity:    8,589,934,592 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   6
ATA Standard is:  ATA/ATAPI-6 published, ANSI INCITS 361-2002
Local Time is:    Mon Jun 28 22:16:37 2010 PDT
SMART support is: Unavailable - device lacks SMART capability.
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

Solution 2:

The way I'd do it is...

smartctl -i /dev/sda

It will dump the SMART device information. This should give you a model number and maybe even serial number for the drive.