List Partitions in Linux with fdisk

You can pull a list of disks attached to a system with the fdisk -l (that's a lower case L as in list) command.  You can use good ol' grep to search for disks of a specific type.

For instance, let's say you want to pull a list of Fibre Channel disks.  Fibre Channel is essentially just SCSI traffic, so Linux lists Fibre Channel LUNs as SCSI disks with the sd prefix (e.g. sda, sdb, etc.).  To get a list of all SCSI-style disks, use the following command:

fdisk -l | grep "Disk /dev/sd"

BTFDisk.jpg


Remember that grep is case sensitive unless you add the -i switch, so make sure to capitalize the D in Disk.  If you're lazy, just add the switch:

fdisk -l | grep -i "disk /dev/sd"