How can I find out what hard disks are attached to a Linux box?
sudo lshw -class disk
gives you everything but the mount point
*-cdrom description: CD-R/CD-RW writer product: 52MAXX 3252AJ vendor: Memorex physical id: 0 bus info: scsi@0:0.0.0 logical name: /dev/cdrom logical name: /dev/cdrw logical name: /dev/scd0 logical name: /dev/sr0 version: QWS3 capabilities: removable audio cd-r cd-rw configuration: ansiversion=5 status=nodisc *-disk:0 description: SCSI Disk product: ZIP 100 vendor: IOMEGA physical id: 0.1.0 bus info: scsi@0:0.1.0 logical name: /dev/sda version: 12.A capabilities: removable configuration: ansiversion=5 *-medium physical id: 0 logical name: /dev/sda *-disk:1 description: ATA Disk product: WDC WD800AB-00CB vendor: Western Digital physical id: 1 bus info: scsi@1:0.0.0 logical name: /dev/sdb version: 04.0 serial: WD-WCAA52477019 size: 74GiB (80GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 signature=90909090
sudo lshw -class disk -html
fdisk -l
An alternative to lshw:
hwinfo --disk
Also has '--short' option, if you're only interested in the /dev and model name and not all the details.
hal9k:~ # hwinfo --disk --short
disk:
/dev/sda Hitachi HDT72502
/dev/sdb Generic USB SD Reader
/dev/sdc Generic USB CF Reader
/dev/sdd Generic USB SM Reader
/dev/sde Generic USB MS Reader
Long version gives you more details then lshw:
hal9k:~ # hwinfo --disk
16: IDE 200.0: 10600 Disk
[Created at block.243]
UDI: /org/freedesktop/Hal/devices/storage_serial_SATA_Hitachi_HDT7250_VFL104R62EUUTX
Unique ID: 3OOL.JSHCimqnHw6
Parent ID: CvwD.epf1vnVqQVC
SysFS ID: /class/block/sda
SysFS BusID: 2:0:0:0
SysFS Device Link: /devices/pci0000:00/0000:00:05.0/host2/target2:0:0/2:0:0:0
Hardware Class: disk
Model: "Hitachi HDT72502"
Vendor: "Hitachi"
Device: "HDT72502"
Revision: "V5DO"
Serial ID: "VFL104R62EUUTX"
Driver: "sata_sis", "sd"
Driver Modules: "sata_sis"
Device File: /dev/sda
Device Files: /dev/sda, /dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFL104R62EUUTX, /dev/disk/by-id/ata-Hitachi_HDT725025VLA380_VFL104R62EUUTX, /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0, /dev/disk/by-id/edd-int13_dev80
Device Number: block 8:0-8:15
BIOS id: 0x80
Geometry (Logical): CHS 30401/255/63
Size: 488397168 sectors a 512 bytes
Geometry (BIOS EDD): CHS 484521/16/63
Size (BIOS EDD): 488397168 sectors
Geometry (BIOS Legacy): CHS 1023/255/63
Config Status: cfg=no, avail=yes, need=no, active=unknown
Attached to: #9 (IDE interface)
[...]
EDIT:
As for the packages availability. I'm using OpenSUSE 11.1. hwinfo is in the standard repository, while lshw is only available from unofficial one.
When I run:
# lsblk
it returns tree disk-partition with mountpoints (for those partitions that have):
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 278.9G 0 disk
+-sda1 8:1 0 500M 0 part /boot
+-sda2 8:2 0 278.4G 0 part
+-vg_devlinux02-lv_root (dm-0) 252:0 0 50G 0 lvm /
+-vg_devlinux02-lv_swap (dm-1) 252:1 0 32G 0 lvm [SWAP]
sdb 8:16 0 14.6T 0 disk
+-sdb1 8:17 0 14.6T 0 part
+-vg_devlinux02-lv_home (dm-2) 252:2 0 12.8T 0 lvm /home
sr0 11:0 1 1024M 0 rom
sdc 8:32 0 2.7T 0 disk
+-sdc1 8:33 0 128M 0 part
+-sdc2 8:34 0 2.7T 0 part
sdd 8:48 0 2.7T 0 disk
+-sdd1 8:49 0 2.7T 0 part
sde 8:64 0 2.7T 0 disk
+-sde1 8:65 0 2.7T 0 part
sdf 8:80 0 2.7T 0 disk
+-sdf1 8:81 0 128M 0 part
+-sdf2 8:82 0 2.7T 0 part
/proc/diskstats will have stats on all your extant drives, whether or not they have partitions on them.