Click to See Complete Forum and Search --> : List Available Disks


JuiceWVU202
03-20-2006, 10:48 PM
Does anyone know of a way to list all raw hard disks attached to a computer, for example /dev/hda and what not weather or not they have any partitions mounted?

Thanks,
Josh

Icarus
03-21-2006, 12:36 AM
mount will show what is mounted where and you can use cfdisk to check a disk for partitions

voidinit
03-21-2006, 12:48 AM
Does anyone know of a way to list all raw hard disks attached to a computer, for example /dev/hda and what not weather or not they have any partitions mounted?

Thanks,
Josh



Other info can be found in /proc/partitions & /proc/diskstats:

more /proc/partitions
more /proc/diskstats

You can cross reference that /proc/partitions with diskstats to see which are mounted, etc.

je_fro
03-21-2006, 05:14 AM
I usually just do dmesg | grep hd

JuiceWVU202
03-21-2006, 07:29 AM
Jefro, exactly what i'm looking for, it even shows scsi/sata devices. Thanks.

bwkaz
03-21-2006, 07:53 PM
Also check out your /sys/block directory. It'll have more than just hard drives in there (it'll have any block device, so floppies, loopback devices, etc. are also included), but it will have all your disk drives. Each of the disk drive directories will have a subdirectory for each of its partitions.

(This requires a 2.6 kernel, though, with sysfs mounted.)