There is a special file “/proc/partitions” in the proc file system interface exported by Linux kernel. This file contains information of all drives, partitions and their sizes present in the system. A sample file is shown below. This contains only one drive sda which has seven partitions sda1 through sda7 out of which sda4 is Windows extended partition.

[neo@techpulp ~]# cat /proc/partitions
major minor  #blocks  name

8     0  117220824 sda
8     1   13309821 sda1
8     2   34186320 sda2
8     3   18040995 sda3
8     4          1 sda4
8     5   40050013 sda5
8     6   10747453 sda6
8     7     883543 sda7
[neo@techpulp ~]#

If you have more than one hard drive or an USB flash disk connected, you will see more drives like sdb and sdc etc along with the information of partitions in them.

But the better way to identify device name of removable media like CD/DVS or USB flash disks is to check the messages towards the end of kernel messages printed by “dmesg” command.

[neo@techpulp ~]# dmesg | tail
sd 4:0:0:0: [sdb] 4030464 512-byte hardware sectors (2064 MB)
sd 4:0:0:0: [sdb] Write Protect is off
sd 4:0:0:0: [sdb] Mode Sense: 23 00 00 00
sd 4:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 4:0:0:0: [sdb] Attached SCSI removable disk
sd 4:0:0:0: Attached scsi generic sg2 type 0
FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
SELinux: initialized (dev sdb1, type vfat), uses genfs_contexts
usb 1-5: USB disconnect, address 4
[neo@techpulp ~]#

From the above messages, you can identify that a USB flash disk of size 2GB is inserted and it has been identified as sdb.