How To detect USB drive device file
Hello,
How can I detect a device file for a USB Mass storage (i.e /dev/sda1 or dev/sdb2) etc?
I want get this info (i.e /dev/sd[a-z]*) using a C program. I have to use it in GUI to mount/unmount. I will be using multiple USB devices......so i need to map the correct device file to particular USB drive.
Though the following commands give the info i required, how can I get this info programtically?
$"dmesg" will give the info
>> it will consist the info like
sda:sda1
and also
$"fdisk -l "
will give the info of all device pulgged in.
Please help in this regard.
Thanks in Advance
KR
|