I want to write a C++ function that can give me a list of hard drives in a machine (running Linux), but I want to filter out any USB flash drives.
When I read /proc/partitions I find sda and sdb, but I think that is not enough to differentiate between the primary hard drive and the USB flash drive. Is there a way to do this?
Thanks!
You could use the symlinks in:
For example, I have:
You can spot the USB device in there pretty easily.
Look at the directories pointed to by those symlinks, there’s a bunch of useful information there as well.