ABBAPOH
ABBAPOH

Reputation: 11

How to get drive label in Linux using C from userspace

I need to get a label for specific device using c/c++ (and no d-bus) in linux. The problem is that i can't just open device and read it's information (for extN it is very easy to get label from device) because reading from /dev/xxx requires root privileges.

Upvotes: 1

Views: 1807

Answers (1)

Jens Gustedt
Jens Gustedt

Reputation: 79003

I think in most distributions now you have

/dev/disk/by-label/

which is filled with symlinks that point to the real device.

Upvotes: 1

Related Questions