리눅스 및 유닉스 UUID 관련 질문입니다..

morolty의 이미지

일단 uuid에 대한 질문을 하는 목적은,

하나의 시스템에서 여러개의 OS가 있을 경우 그 OS에 대한 구분을 하기 위해서 입니다.

일단 OS 내에서 UUID의 경우는 반드시 유니크한 값이 될 것이고, 각각의 OS의 UUID는 OS별로 완벽하지는 않지만 거의 유니크할 것이라 생각해서 감안하고 진행하려 합니다.

그래서 dmidecode 명령어를 이용하여 system-uuid를 추출하려 하는데요

[root@ ~]# dmidecode -t 1
# dmidecode 2.11
SMBIOS 2.5 present.
 
Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: innotek GmbH
        Product Name: VirtualBox
        Version: 1.2
        Serial Number: 0
        UUID: 4E6499F7-D305-4037-AC8F-A859832246F9
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Virtual Machine
 
[root@ ~]#

1. 이 uuid가 OS에 대한 uuid가 맞는것인지 (보통 disk를 구분하기 위해 uuid를 사용한다고 나와있더군요)

2. dmidecode 명령이 없는 리눅스 시스템에서는 어떻게 추출해야 할지
-> cat /etc/fstab 을 해서

...
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=27b0511a-9a93-4839-a57f-e7f6947be49a /boot                   ext4    defaults
...

라는 결과를 얻었는데, 이 uuid가 system-uuid라고 생각해도 되는지..

3. 유닉스 시스템에서는 uuid가 아닌 혹시 다른 방법이 있을지.. (윈도우 s/n 처럼요..)

이렇게 총 세가지의 궁금한점이 있습니다. 알고계신다면 답변해주시면 정말 감사드리겠습니다.

goforit의 이미지

다음 두 결과를 비교해서 보면 다릅니다.

ubuntu@PlusGenie:~$ sudo dmidecode -t 1
# dmidecode 2.11
# No SMBIOS nor DMI entry point found, sorry.

SMBIOS를 설정을 안해서 일까요??? 잘 모르겠네요.

이 것이 하나의 OS 안에서 Disk에 사용되는 UUID입니다.

ubuntu@PlusGenie:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 11 May  7 12:26 1483efe7-f082-4862-a253-2d12f2bf1fb6 -> ../../xvda1
lrwxrwxrwx 1 root root 10 May  7 12:26 ad066a33-3c5c-44af-a6ab-0522092ca19b -> ../../xvdf

morolty의 이미지

dmidecode -t system 이라고 해보시면 아마 나오실듯 합니다..

디스크라든지 cpu라든지 메모리 등등은 디스크 uuid, MAC Address, serial 등의 유니크 값으로 따로 분류를 할 예정이라..

OS에 관련된 유니크 키 값만 있으면 될거 같습니다. 그 유니크 키 값을 dmidecode -t system 해서 나오는 UUID로 설정해도 될려나.. 하는 의미였네요.. 제가 글을 잘 못써서 의미전달이 잘 안된 듯 싶습니다 ..

qiiiiiiiip의 이미지

dmidecode는 hardware 정보를 보여주는 것이기때문에 OS와는 관련이 없습니다.
dmidecode가 설치되지 않았더라도
/sys/class/dmi/id/product_uuid 파일을 보면 될 것 같고요.

아래 링크에 따르면 원하시는 종류의 것은 없을 것 같습니다.
http://stackoverflow.com/questions/328936/getting-a-unique-id-from-a-unix-like-system

가장 근접한 것이 root 파티션의 uuid 정도일텐요.
한 root파티션에 여러 OS를 설치하는 경우는 거의! 없을 것 같네요.

문제는 위의 링크에도 나와 있듯이,이런 종류의 s/w적인 정보는
보통 대규모 OS를 설치할때는 설치된 이미지를 이용하기 때문에
uniqness를 보장할 수가 없다는 것이겠네요..

--

좀더 찾아보니 이런 링크가 있네요..
http://0pointer.de/blog/projects/ids.html

여기에 따르면 /var/lib/dbus/machine-id 를 쓰라네요.

/var/lib/dbus/machine-id: An ID identifying a specific Linux/Unix installation. It does not change if hardware is replaced. It is not unreliable in virtualized environments. This value has clear semantics and is considered part of the D-Bus API. It is supposedly globally unique and portable to all systems that have D-Bus. On Linux, it is universally available, given that almost all non-embedded and even a fair share of the embedded machines ship D-Bus now. This is the recommended way to identify a machine, possibly with a fallback to the host name to cover systems that still lack D-Bus. If your application links against libdbus, you may access this ID with dbus_get_local_machine_id(), if not you can read it directly from the file system.

--

원글자분의 용도로는 root 파티션의 uuid를 쓰는게 맞을 것 같습니다.
구하는 방법은
/etc/fstab 과 /dev/disk/by-uuid 를 교차 확인하시면 되겠습니다

morolty의 이미지

저와 같은 결론인것 같네요! 감사합니다. 참고하도록 하겠습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.