Announcement

Collapse
No announcement yet.

[SOLVED] how to get volume ID (label) for mounted CDROM

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] how to get volume ID (label) for mounted CDROM

    I want to make a system call from within a Ruby program, to get the volume label for a CD the program just mounted on /media/cdrom. I've tried a number of things, with no success. I don't know what to Google for next! I'm just trying to get something to work from the Kubuntu command line. I can take it from there.

    Most likely to work appears to be something like -

    vol_id --label \media\cdrom

    BUT, that's not right. It responds with "unknown volume type"

    I tried this -

    ls /media/cdrom0 /dev/disk/by-label

    and got -

    /dev/disk/by-label:
    Local\x20Disk

    That's just not helpful. The disk label is actuall "cdr050".

    I'm no Linux whiz, and I don't really what to try next. Can anyone tell me how to do this, please?

    #2
    Re: how to get volume ID (label) for mounted CDROM

    Try blkid.

    Comment


      #3
      Re: how to get volume ID (label) for mounted CDROM

      Well nuts. I looked really hard for this and still didn't find it.

      And now...it doesn't do anything. I've studied the man page. Here's some sample console output...

      tomc@tom-desktop:/media$ blkid /cdrom
      tomc@tom-desktop:/media$
      tomc@tom-desktop:/media$ blkid cdrom
      tomc@tom-desktop:/media$

      No error report. Just nothing. I don't see the problem. Can anyone suggest the problem?

      Thanks!

      Comment


        #4
        Re: how to get volume ID (label) for mounted CDROM

        I think if the cdrom is mounted you can just type blkid all by itself. But I imagine if you read the man page you're doing it right but something just isn't working correctly. Sorry I can't be of more assistance.

        Comment


          #5
          Re: how to get volume ID (label) for mounted CDROM

          Originally posted by Nate
          I think if the cdrom is mounted you can just type blkid all by itself.
          Not really. When I do that, I simple get a blank command line back. I have found examples, Googling, of that use of the command, and on other Linux OSs it does appear to work as you describe, but not on Kubuntu.

          But I imagine if you read the man page you're doing it right but something just isn't working correctly. Sorry I can't be of more assistance.
          Who knows? Not me.

          I just spent about an hour digging around trying to make sense of the command. The documentation (man page) is, to me, extreme obscure. No help at all. Offers NO usage examples.

          I did find a usage example, by Googling again, and modified it, with this result:

          $ blkid /dev/cdrom
          /dev/cdrom: LABEL="cdr058" TYPE="iso9660"
          tomc@tom-desktop:/media$

          It's exactly what I'm looking for. I can all this command, put its output into a string, locate the LABEL info and extract it, and I will have my mounted CD label quite handily.

          My fundamental problem is that I really don't know Linux basics at all well, and never have time to learn. Time poverty is a terrible thing...

          Comment


            #6
            Re: [SOLVED] how to get volume ID (label) for mounted CDROM

            When I type blkid I get something like this:

            Code:
            /dev/sda1: UUID="e694e9ab-1e27-4fd3-9859-fe8283558cfc" SEC_TYPE="ext2" TYPE="ext3"
            /dev/sda5: UUID="444ed0fc-9695-4379-876c-6538e469a43d" SEC_TYPE="ext2" TYPE="ext3"
            /dev/sda6: TYPE="swap" UUID="5e3c5bad-6bed-4770-8103-526e24adb2af"
            There's more as well, but I just copied and pasted some of my drives. I have no idea why yours would be completely blank.

            Comment


              #7
              Re: [SOLVED] how to get volume ID (label) for mounted CDROM

              http://linux.die.net/man/8/blkid

              You need to have the package libuuid1 installed, which I thought was included by default.

              Comment

              Working...
              X