LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Getting the volume serial number of a disk. (https://www.linuxquestions.org/questions/slackware-14/getting-the-volume-serial-number-of-a-disk-851548/)

stf92 12-21-2010 04:20 AM

Getting the volume serial number of a disk.
 
Kernel 2.6.21.5, Slackware 12.0

Hi:
Code:

root@darkstar:~# blkid
/dev/sda: LABEL="MAESTRO!" UUID="4730-D359" TYPE="vfat"
/dev/hdc: LABEL="STORE1 ver. 2 (overrules ver. 1)" TYPE="iso9660"
/dev/hdd: LABEL="DISK2" TYPE="iso9660"
/dev/hda1: UUID="240E-CADD" TYPE="vfat"
/dev/hda2: TYPE="swap" UUID="363c66d2-244e-43fe-83a0-f961de6e8462"
/dev/hda3: UUID="1995eba6-536c-4339-b0ef-f5d045d22735" TYPE="ext2"
/dev/hdb1: SEC_TYPE="msdos" LABEL="MS-DOS_5" UUID="22D4-2062" TYPE="vfat"
/dev/hdb2: LABEL="BIG" UUID="1523-19DD" TYPE="vfat"
/dev/hdb5: LABEL="ALMACEN" UUID="C841-0655" TYPE="vfat"
/dev/sda1: LABEL="MAEEESTRO" UUID="4D05-22AE" TYPE="vfat"
root@darkstar:~#

Code:

root@darkstar:~# vol_id /dev/hdc
ID_FS_USAGE=filesystem
ID_FS_TYPE=iso9660
ID_FS_VERSION=
ID_FS_UUID=
ID_FS_UUID_SAFE=
ID_FS_LABEL=STORE1 ver. 2 (overrules ver. 1)
ID_FS_LABEL_SAFE=STORE1_ver._2__overrules_ver._1_
root@darkstar:~#

As you can see, the first command gives numbers like C841-0655.
But for the optical disks (iso9660) it gives them not. Neither does the second one. This number is known as 'Volume serial number' in MS-DOS, and is printed on console with the command 'dir' not only for the HDD partitions but for the optical disks too.

The question is: how to get an optical disk Volume serial number? Notice that this number is inherent to the media (is a property of the media, under any O.S.). Any hint will be welcome.

Aquarius_Girl 12-21-2010 04:36 AM

Does this thread help?
http://www.linuxquestions.org/questi...11-2-a-819367/

stf92 12-21-2010 05:02 AM

Thanks for your post. I've read your link through but I'm afraid you did not quite understand. The command hdparm -i <device> gives you the drive serial number. Instead, every partition on a hard drive has a unique UUID. For the case of vfat, this UUID is of the form MMMM-NNNN, say 5A4B-32A0 and is a part of the Bios Parameter Block.

Now, CD-ROMs also have a number of the form MMMM-NNNN. I'll skim the Orange Book specification to see how to read it by program, but shame on Linux if it has not the adequate tool. Regards.

Aquarius_Girl 12-21-2010 05:04 AM

then I am sorry for taking your thread off the zero reply list, hope this gives it a bump.

wildwizard 12-21-2010 06:04 AM

Quote:

Originally Posted by stf92 (Post 4198675)
Notice that this number is inherent to the media (is a property of the media, under any O.S.). Any hint will be welcome.

This thread got me curious so I did some searching ... The Volume ID is generated by DOS/Windows from the time stamp on the disk for when it was created.

http://www.linuxquestions.org/questi...ubuntu-714693/

stf92 12-21-2010 06:10 AM

Yes, but for the case of a CD-R, either it's set by the manufacturer or by the authoring tool used. Under MS-DOS, if I do 'dir H:', where H: is the optical drive and this drive contains an audio CD (CDDA) then the said serial number is displayed. That is, even Red Book CDs have this serial number. Thanks for your reply.

syg00 12-21-2010 06:23 AM

UUID is not the device/media serial number. It is a filesystem specific identifier.
For brain-dead filesystems (like [v]fat), they are generated by your Linux system.

wildwizard 12-21-2010 06:23 AM

Quote:

Originally Posted by stf92 (Post 4198790)
Yes, but for the case of a CD-R, either it's set by the manufacturer or by the authoring tool used.

Going with English is not your first language here.

I just told you that the Volume ID reported by DOS/Windows is a derived number from a time stamp on the disk when it was created.

This VOL ID number is NOT stored on the disk it is made by DOS/Windows and the code to generate the number is available from Microsoft.

You will not find the VOL ID anywhere on an optical disk no matter how hard you look, it just does not exist outside of DOS/Windows.

stf92 12-21-2010 06:56 AM

Of course you're speaking about optical disks, I'll assume. However, the SFF Committee document INF-8090 Rev 6.1 (Feb 8, 2006) speaks about a media serial number. Unfortunately, it refers to MMC. Regards.

kapz 12-21-2010 11:20 AM

Quote from wiki article:
Quote:

The serial number is a 32-bit number determined by the date on the current computer[2] at the time of a disk's formatting.
http://cboard.cprogramming.com/linux...ber-linux.html this relates to your question, though am not sure how much it will help you..

jcas1411 12-22-2010 02:21 PM

have a look at lshw. This is what I use. I write it to xml and then display nicely in my program. You get all the hardware info along with the disk serials and volume serials. http://ezix.org/project/wiki/HardwareLiSter

here is a snippet from lshw output on my system (just showing a disk). Notice the serial for each volume and the disk serials


Code:

<node id="disk" claimed="true" class="disk" handle="SCSI:00:00:00:00">
        <description>ATA Disk</description>
        <product>ST3160318AS</product>
        <vendor>Seagate</vendor>
        <physid>0</physid>
        <businfo>scsi@0:0.0.0</businfo>
        <logicalname>/dev/sda</logicalname>
        <dev>8:0</dev>
        <version>HP11</version>
        <serial>9VY0L9TQ</serial>
        <size units="bytes">160041885696</size>
        <configuration>
          <setting id="ansiversion" value="5" />
          <setting id="signature" value="bb90bb90" />
        </configuration>
        <capabilities>
          <capability id="partitioned" >Partitioned disk</capability>
          <capability id="partitioned:dos" >MS-DOS partition table</capability>
        </capabilities>
          <node id="volume:0" claimed="true" class="volume" handle="">
          <description>Windows NTFS volume</description>
          <physid>1</physid>
          <businfo>scsi@0:0.0.0,1</businfo>
          <logicalname>/dev/sda1</logicalname>
          <dev>8:1</dev>
          <version>3.1</version>
          <serial>daf2ee50-c13e-f04b-ae77-440bbf79fa0f</serial>
          <size>52427869696</size>
          <capacity>52427902464</capacity>
          <configuration>
            <setting id="clustersize" value="4096" />
            <setting id="created" value="2009-11-09 08:33:47" />
            <setting id="filesystem" value="ntfs" />
            <setting id="label" value="SA-CIS" />
            <setting id="state" value="clean" />
          </configuration>
          <capabilities>
            <capability id="primary" >Primary partition</capability>
            <capability id="bootable" >Bootable partition (active)</capability>
            <capability id="ntfs" >Windows NTFS</capability>
            <capability id="initialized" >initialized volume</capability>
          </capabilities>
          </node>
          <node id="volume:1" claimed="true" class="volume" handle="">
          <description>Windows NTFS volume</description>
          <physid>2</physid>
          <businfo>scsi@0:0.0.0,2</businfo>
          <logicalname>/dev/sda2</logicalname>
          <dev>8:2</dev>
          <version>3.1</version>
          <serial>96ad2bcb-d33b-e94d-89eb-d174704f11eb</serial>
          <size>52930208768</size>
          <capacity>52946127360</capacity>
          <configuration>
            <setting id="clustersize" value="4096" />
            <setting id="created" value="2009-11-17 09:09:57" />
            <setting id="filesystem" value="ntfs" />
            <setting id="label" value="CIS_Ouput" />
            <setting id="state" value="clean" />
          </configuration>
          <capabilities>
            <capability id="primary" >Primary partition</capability>
            <capability id="ntfs" >Windows NTFS</capability>
            <capability id="initialized" >initialized volume</capability>
          </capabilities>
          </node>
          <node id="volume:2" claimed="true" class="volume" handle="">
          <description>EXT3 volume</description>
          <vendor>Linux</vendor>
          <physid>3</physid>
          <businfo>scsi@0:0.0.0,3</businfo>
          <logicalname>/dev/sda3</logicalname>
          <dev>8:3</dev>
          <version>1.0</version>
          <serial>97b6252b-b8d4-4341-bedf-d22519f43d8c</serial>
          <size>54665207808</size>
          <capacity>54665210880</capacity>
          <configuration>
            <setting id="created" value="2010-03-25 10:32:48" />
            <setting id="filesystem" value="ext3" />
            <setting id="modified" value="2010-12-14 08:09:21" />
            <setting id="mounted" value="2010-12-14 04:26:14" />
            <setting id="state" value="clean" />
          </configuration>
          <capabilities>
            <capability id="primary" >Primary partition</capability>
            <capability id="journaled" />
            <capability id="extended_attributes" >Extended Attributes</capability>
            <capability id="large_files" >4GB+ files</capability>
            <capability id="ext3" />
            <capability id="ext2" >EXT2/EXT3</capability>
            <capability id="initialized" >initialized volume</capability>
          </capabilities>
          </node>
        </node>


stf92 12-22-2010 06:40 PM

Thank you for your post, jcas1411. I have downloaded and run lshw but the serial numbers are nowhere to be seen. The syntax I used is this:
Code:

$ lshw
$

. Regards.

Laodiceans 12-23-2010 01:35 AM

I just did sdparm -i /dev/sda for mine.

jcas1411 12-23-2010 09:01 AM

The command I use is lshw -xml. Nothing special but it does show the serial of hard disks and volumes on those disks. Be sure to send this to a file lshw -xml > ~/Desktop/harware.txt or pipe it to less as it may run past the buffer limit on the terminal. If you running this in a vmware world looking at a virtual disk you will only get a volume serial because virtual disks do not have serials. I ran on my physical computer and it does show as above, serial for hard disk, and volume serials.


I dont think it will show serials of optical disks, is that what you are wanting?

John

jcas1411 12-23-2010 09:43 AM

serial number of the optical drive itself can be found with

hdparm -I /dev/sr0

if sr0 is your optical drive.

this does not help with the volume (a mounted cd)


All times are GMT -5. The time now is 03:09 AM.