Linux Hotplug development
 help / color / mirror / Atom feed
From: Scott Talbert <talbert@techie.net>
To: linux-hotplug@vger.kernel.org
Subject: Behavior with duplicate UUID's
Date: Mon, 09 Aug 2010 01:19:49 +0000	[thread overview]
Message-ID: <alpine.LRH.2.00.1008082106310.18424@bear.techie.net> (raw)

Hello,

I am looking at udev's behavior when duplicate UUID's are present (ie, 
partition a and partition b both have the same UUID) in a system.  Yes, 
this is a rather rare case, but it can happen if, for instance, one 
partition is cloned to another.

Right now, it appears that the behavior for creating the /dev/disk/by-uuid 
links is "last one in wins."  For example, if I have /dev/sda1 with UUID X 
in a system, and then add another drive with a /dev/sdb1 with UUID X, 
/dev/sdb1 ends up with its link in /dev/disk/by-uuid.  It would seem to me 
that "first one in wins" might be a better approach.  That is, when 
/dev/sdb1 comes along later, /dev/sda1's link would persist in 
/dev/disk/by-uuid.

Thoughts?  I modified the existing rule slightly (see below) and this 
seems to implement the "first one in" behavior.

--- /lib/udev/rules.d/60-persistent-storage.rules	2010-04-19 05:30:29.000000000 -0400
+++ parted/60-persistent-storage.rules	2010-08-08 20:43:45.000000000 -0400
@@ -63,7 +63,7 @@
  KERNEL!="sr*", OPTIONS+="watch"

  # by-label/by-uuid links (filesystem metadata)
-ENV{ID_FS_USAGE}="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}="?*", TEST!="/dev/disk/by-uuid/$env{ID_FS_UUID_ENC}", 
SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}="filesystem|other", ENV{ID_FS_LABEL_ENC}="?*", 
SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"

  # by-id (World Wide Name)

--
Thanks,
Scott Talbert

             reply	other threads:[~2010-08-09  1:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09  1:19 Scott Talbert [this message]
2010-08-09  8:02 ` Behavior with duplicate UUID's Kay Sievers
2010-08-11  3:05 ` Scott Talbert
2010-08-11  8:17 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.00.1008082106310.18424@bear.techie.net \
    --to=talbert@techie.net \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox