Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to retrieve the disk identifier from the disk name? For example I have a disk partition /Volumes/Data and I would like to store the disk identifier in a variable.

Any help?

share|improve this question

migrated from Apr 14 '14 at 23:27

This question came from our site for professional and enthusiast programmers.

Use df command and store column1 –  anubhava Apr 14 '14 at 14:47
@anubhava - that fails if the device is longer than df's column width. FreeBSD appears to lengthen the line if device names are long, but on a Linux box I have here, df splits lines, so more complex parsing is required. –  ghoti Apr 14 '14 at 17:13
That's probably true but OP hasn't provided any realistic information in his question to warrant an answer, that's I just left a comment. –  anubhava Apr 14 '14 at 17:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.