Equivalent to volume serial number in linux

This is a discussion on Equivalent to volume serial number in linux within the Linux Programming forums, part of the Platform Specific Boards category; I have a system whose server runs on linux and clients run on windows currently. I would very much like ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2,539

    Equivalent to volume serial number in linux

    I have a system whose server runs on linux and clients run on windows currently. I would very much like to port the client over to linux, but the current system uses MAC address, hostname, and volume serial number to authenticate stations. Is there an equivalent value in linux for volume serial number, or something else that is equally unique per-machine that would be useful for authentication, and could easily be hashed down to a 32-bit number? I've been searching google and this forum for over an hour and have found nothing useful. I found reference to an entry in /proc and another reference to using hdparm, but hdparm fails on my server, probably because it is for ide/ata drives, and the /proc entry does not exist on my server. I'm really hoping someone here knows something, because this is really holding me up in my efforts to develop a linux port of my client.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,691
    There's "scsi_id" for non-ata drives...

    gg

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,263
    Is it really appropriate to authenticate clients with host characteristics? What sort of system is this where the user doesn't matter in the authentication process?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,539
    Quote Originally Posted by brewbuck View Post
    What sort of system is this where the user doesn't matter in the authentication process?
    the user matters, but the station is also important. different stations have different devices (bill acceptors, receipt printers, credit card readers, etc.) installed, some of which require that a persistent state be stored on the server, which demands that the server be able to positively identify which station it is talking to.

    as a workaround, I get the output of "uname -a" and hash it down to a 32-bit quantity and use that. it is not quite as unique as a volume serial number, but at least it doesn't change over time without a change of kernel.

  5. #5
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,263
    Newer Linux distributions allow you to mount drive partitions by "volume ID" -- these IDs will be visible in the /etc/fstab file. You might try checking there.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,539
    Quote Originally Posted by brewbuck View Post
    Newer Linux distributions allow you to mount drive partitions by "volume ID" -- these IDs will be visible in the /etc/fstab file. You might try checking there.
    no such luck in this case. can you think of any other data that I can readily get from the system that is as unique as a volume serial number, aside from hostname and MAC?

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,751
    You could do several things when you first run the program, and store the results in a file somewhere.

    - the 32-bit time of when the program was run.
    - the 32-bit value composed of the pid() and parent pid() of the registration task.
    - the 32-bit uptime at that moment.

    Or just use a uuid generator
    uuid_generate(3): create new unique UUID value - Linux man page
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Code:
    sudo vol_id --uuid /dev/sda1
    ?

  9. #9
    Registered User
    Join Date
    Oct 2006
    Posts
    2,539
    Quote Originally Posted by cyberfish View Post
    Code:
    sudo vol_id --uuid /dev/sda1
    ?
    I downloaded and installed the rpm package for that program, and it seems to work, and may be exactly what the doctor ordered.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wireless Network Linux & C Testbed
    By james457 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-11-2009, 12:03 PM
  2. Number Guessing
    By blacknapalm in forum C Programming
    Replies: 2
    Last Post: 10-01-2008, 02:48 AM
  3. Linux serial port interrupts
    By danga1993 in forum Linux Programming
    Replies: 1
    Last Post: 04-28-2007, 12:15 PM
  4. Linux equivalent of con
    By dwks in forum Linux Programming
    Replies: 3
    Last Post: 11-12-2005, 11:58 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-26-2001, 12:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21