Find the answer to your Linux question:
Results 1 to 3 of 3
Is there any C function that will translate UUIDs into device names? I have a little graphical mount tool that can read user-mountable device names from /etc/fstab and lets you ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,277

    [SOLVED] How can I get from a disk UUID to a device name?


    Is there any C function that will translate UUIDs into device names? I have a little graphical mount tool that can read user-mountable device names from /etc/fstab and lets you cycle through the list and mount or unmount them. But it doesn't work with UUIDs, which are preferred these days. Is there any way around this?
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  2. #2
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    The blkid command will give you the info, but I'm not too sure how you would implement it into your program. Maybe somehow you could parse the into of blkid command and filter out only the info you want.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

  3. #3
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,277
    Thanks, Mike! That wasn't quite the answer but it led me to a possible answer.

    The man page for blkid(8) has a cross-reference to libblkid(3), which describes the file /etc/blkid.tab where this information is stored. Basically I need to write a more complex parsing routine for fstab which picks up device names directly but passes UUIDs to a secondary search function. This would look them up in blkid.tab (probably using strstr()) and would return the device name from there. Complicated but doable.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •