UUID's - just discovered their value - Mandriva

This is a discussion on UUID's - just discovered their value - Mandriva ; The choice between identifying partitions by their /dev names and by UUID's is not easy. Either way you lose. Mandriva's /etc/fstab uses UUID's by default. We don't normally reinstall Linux every few months, but Windows needs it. I formatted my ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: UUID's - just discovered their value

  1. UUID's - just discovered their value

    The choice between identifying partitions by their /dev names and by UUID's
    is not easy. Either way you lose.

    Mandriva's /etc/fstab uses UUID's by default. We don't normally reinstall
    Linux every few months, but Windows needs it. I formatted my Windows drive
    (partition 1 of a SATA disk) and it was given a new UUID. Result -
    Mandriva's Immune System rejected it.

    So, I added my external backup drive (the old IDE in a USB case)
    as /dev/sdc. Pulled out my Flash drive, and /dev/sdc/ became /dev/sdb.
    The bootup procedure dropped me to a maintenance prompt.

    This was plainly a case for an unchanging disk ID. But where to find the
    UUID? One link had said that only /dev/hda1 and /dev/hda2 have them - not
    logical drives in an extended partition. Oh yeah? They are out there in
    the wild, nevertheless.

    From the Ubuntu forums:

    "The best way that I have found is to cd to /dev/disk/ there you have the
    choice to view by id, by path, or by uuid."

    Fine for /dev/sda's partitions, but for nothing else.

    Then the next suggestion there:

    "hal-find-by-property -–key volume.mount_point --string /media/disk

    This way it returns the id of the usb disk which in the end contains it's
    uuid."

    Perhaps, but what are all those extra parameters?

    Finally, I turned up this one, again for (K)Ubuntu, from
    http://www.granneman.com/blog/2007/0...d-drives-uuid/

    "$ sudo vol_id /dev/sdo1
    Password:
    ID_FS_USAGE=filesystem
    ID_FS_TYPE=ext3
    ID_FS_VERSION=1.0
    ID_FS_UUID=4857d4bb-5f6b-4f21-af62-830ebae92cff
    ID_FS_LABEL=movies
    ID_FS_LABEL_SAFE=movies"

    Just perfect. Those details are from the example. I got an extra line with
    ID_FS_UUID_ENC, but the number there was the same.

    Hope this helps somebody.

    Incidentally, why isn't there a disk ID that doesn't change with formatting?
    Isn't it essential, to identify a stolen drive? (but that would be disks,
    not partitions.)

    Doug.


  2. Re: UUID's - just discovered their value

    Doug Laidlaw wrote:

    >The choice between identifying partitions by their /dev names and by UUID's
    >is not easy. Either way you lose.


    It's best to replace the UUIDs in /etc/fstab with labels rather than
    device ids, in my opinion. It makes fstab visually understandable again.
    You can still lose the labels on partitions if you reformat them, but at
    least it's easy to add them back from memory, unlike UUIDs. On the other
    hand, I think that the UUIDs in /boot/grub/menu.lst *are* best replaced
    with device ids. YMMV. Anyway, here's a whole bunch of useful commands
    for manipulating labels:

    $ e2label [new-label] # display/set label on ext2/3
    $ mlabel -i /dev/hdaX -s :: # display dos label (from mtools)
    $ mlabel -i /dev/hdaX :: # set dos label
    $ ntfslabel /dev/hdaX # set ntfs label (from ntfsprogs)
    $ mkswap -L /dev/hdaX # set swap label - CHANGES UUID
    $ findfs LABEL=

  3. Re: UUID's - just discovered their value

    On Mon, 08 Sep 2008 22:37:40 +1000, Doug Laidlaw wrote:
    > The choice between identifying partitions by their /dev names and by UUID's
    > is not easy. Either way you lose.


    Then there is my choice of LABEL 8-)


    > Mandriva's /etc/fstab uses UUID's by default. We don't normally reinstall
    > Linux every few months, but Windows needs it. I formatted my Windows drive
    > (partition 1 of a SATA disk) and it was given a new UUID. Result -
    > Mandriva's Immune System rejected it.


    Yep, same problem if you format and restore / from backups. I labeled
    all my partitions.

    $ grep LABEL /etc/fstab
    LABEL=vm2008_1 / ext3 relatime 1 1
    LABEL=local /local ext3 relatime 1 2
    LABEL=20081_64 /20081_64 ext3 user,noauto,relatime 1 2
    LABEL=2008_1 /2008_1 ext3 user,noauto,relatime 1 2
    LABEL=accounts /accounts ext3 relatime 1 2
    LABEL=hotbu /hotbu ext3 user,noauto,relatime 1 2
    LABEL=vmguest /vmguest ext3 relatime 1 2
    LABEL=HP_PAVILION /win_c ntfs-3g user,noauto,defaults,locale=en_US.UTF-8 0 0
    LABEL=DOZE /win_d vfat user,noauto,iocharset=iso8859-1,codepage=850 0 0
    LABEL=HP_RECOVERY /win_e vfat user,noauto,iocharset=iso8859-1,codepage=850 0 0
    LABEL=swap swap swap defaults 0 0

    And the quick master list command is

    # blkid /dev/sd*


    If you use LABEL be sure to fix /boot/grub/menu.lst

    title linux
    kernel (hd0,10)/boot/vmlinuz BOOT_IMAGE=linux root=LABEL=vm2008_1 resume=/dev/sda6 splash=0 vga=791
    initrd (hd0,10)/boot/initrd.img


    Short List of label commands:

    e2label /dev/XdYZ [ new-label ]
    tune2fs -Lnew-label /dev/XdYZ
    ReiserFS, use reiserfstune -l new-label /dev/xxx
    XFS use xfs_admin -L new-label /dev/xxx
    JFS you need jfs_tune.
    FAT filesystems use mlabe dosfslabel
    ntfslabel /dev/xxx new-label
    mkswap -L label /dev/hdxx

  4. Re: UUID's - just discovered their value

    On Mon, 08 Sep 2008 08:37:40 -0400, Doug Laidlaw wrote:

    > Finally, I turned up this one, again for (K)Ubuntu, from
    > "$ sudo vol_id /dev/sdo1


    You can also use "blkid /dev/hda1", (if you have e2fsprogs installed),
    to get the label, uuid, and filesystem type.


    > Incidentally, why isn't there a disk ID that doesn't change with formatting?


    "udevinfo -q env -p /block/hda" will give you the drive's serial number.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  5. Re: UUID's - just discovered their value

    On Mon, 08 Sep 2008 12:05:52 -0400, Dave Farrance wrote:

    > It's best to replace the UUIDs in /etc/fstab with labels rather than
    > device ids, in my opinion. It makes fstab visually understandable again.


    Just remember that it's up to you to ensure the labels are unique. The
    system will allow duplicate labels. You can force duplicate uuids too,
    although I wouldn't recommend it.

    After cloning a filesystem using dd, or similar tools, it's a good idea to
    alter the uuid and label, before trying to mount the new filesystem, with
    the old one still available.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  6. Re: UUID's - just discovered their value

    Bit Twister wrote:

    > On Mon, 08 Sep 2008 22:37:40 +1000, Doug Laidlaw wrote:
    >> The choice between identifying partitions by their /dev names and by
    >> UUID's
    >> is not easy. Either way you lose.

    >
    > Then there is my choice of LABEL 8-)
    >
    >
    >> Mandriva's /etc/fstab uses UUID's by default. We don't normally
    >> reinstall
    >> Linux every few months, but Windows needs it. I formatted my Windows
    >> drive
    >> (partition 1 of a SATA disk) and it was given a new UUID. Result -
    >> Mandriva's Immune System rejected it.

    >
    > Yep, same problem if you format and restore / from backups. I labeled
    > all my partitions.
    >
    > $ grep LABEL /etc/fstab
    > LABEL=vm2008_1 / ext3 relatime 1 1
    > LABEL=local /local ext3 relatime 1 2
    > LABEL=20081_64 /20081_64 ext3 user,noauto,relatime 1 2
    > LABEL=2008_1 /2008_1 ext3 user,noauto,relatime 1 2
    > LABEL=accounts /accounts ext3 relatime 1 2
    > LABEL=hotbu /hotbu ext3 user,noauto,relatime 1 2
    > LABEL=vmguest /vmguest ext3 relatime 1 2
    > LABEL=HP_PAVILION /win_c ntfs-3g user,noauto,defaults,locale=en_US.UTF-8 0
    > 0 LABEL=DOZE /win_d vfat user,noauto,iocharset=iso8859-1,codepage=850 0 0
    > LABEL=HP_RECOVERY /win_e vfat user,noauto,iocharset=iso8859-1,codepage=850
    > 0 0 LABEL=swap swap swap defaults 0 0
    >
    > And the quick master list command is
    >
    > # blkid /dev/sd*
    >
    >
    > If you use LABEL be sure to fix /boot/grub/menu.lst
    >
    > title linux
    > kernel (hd0,10)/boot/vmlinuz BOOT_IMAGE=linux root=LABEL=vm2008_1
    > resume=/dev/sda6 splash=0 vga=791 initrd (hd0,10)/boot/initrd.img
    >
    >
    > Short List of label commands:
    >
    > e2label /dev/XdYZ [ new-label ]
    > tune2fs -Lnew-label /dev/XdYZ
    > ReiserFS, use reiserfstune -l new-label /dev/xxx
    > XFS use xfs_admin -L new-label /dev/xxx
    > JFS you need jfs_tune.
    > FAT filesystems use mlabe dosfslabel
    > ntfslabel /dev/xxx new-label
    > mkswap -L label /dev/hdxx


    Sounds good. I didn't even know that any other existed. I had probably
    seen Label used, but wasn't aware that it was anything but a description.
    I normally associate Label with Lilo.

    Doug.

  7. Re: UUID's - just discovered their value

    David W. Hodgins wrote:

    > After cloning a filesystem using dd, or similar tools, it's a good idea to
    > alter the uuid and label, before trying to mount the new filesystem, with
    > the old one still available.


    Cloning is why I took the UUIDs out of the fstab on our workstations.
    When just the "/" partition is cloned it finds itself on other
    workstations with identical hardware but different UUIDs for all the
    other partititions, which as you might expect, doesn't work out so well.
    Using plain old /dev/hda7 (or whatever) is a lot less work.

    All of these disk/partition identification methods have their drawbacks
    though...

    Regards,

    David Mathog

+ Reply to Thread