Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's an easy question for you guys: How do I find out what hard drives are attached to a linux box? I'm hoping for a single command that can give me a nice list of all ata/scsi/etc drives.

I've catted /proc/partitions in the past to do this, but I wonder if that still works if there's a drive with no partitions on it.

share|improve this question
up vote 27 down vote accepted

sudo lshw -class disk

gives you everything but the mount point

       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
       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
          physical id: 0
          logical name: /dev/sda
       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

share|improve this answer
That's pretty good. – Luke May 6 '09 at 5:01
I would use "lshw -C disk -C volume" to also include the partitions – Nils-Anders Nøttseter May 6 '09 at 5:22
and -short to have information easily grep-able – drAlberT Feb 7 '13 at 16:13

fdisk -l

share|improve this answer
One problem I have with with fdisk is that it also shows or errors on dm-crypt devices, or lvm devices, sometimes I like to see the actual disks. – Zoredache May 5 '09 at 22:19
+1 as the default installes for Ubuntu and Debian I have access to don't have lshw – Greg B May 29 '09 at 10:34
fdisk -l | grep ^Disk – Michael Shigorin Oct 27 '14 at 16:24

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
  /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)                                                                                                                         



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.

share|improve this answer
But you need the hwinfo package installed for this to work :'( – Andor May 6 '09 at 9:33
@Andor: true, but to have lshw you also need to install the package. – vartec May 6 '09 at 9:59

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
share|improve this answer
that's very useful, as it also shows which drives/partitions are assembled into which RAID drives – user9999999 Feb 1 at 3:09

/proc/diskstats will have stats on all your extant drives, whether or not they have partitions on them.

share|improve this answer

cat /proc/partitions Is working even if there is no partition defined for disk.

My favorite is lsblk which shows very good detail about disks and partitions, and where they mounted. Also file -s /dev/sda can give you simple information too.

share|improve this answer

I like:

lshw -class disk

which lists all disks and storage controllers in the system.

share|improve this answer
# fdisk -l | grep Disk

is used to display list of harddisk on server

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.