* Duplicate UUIDs, findmnt, /dev/disk/by-uuid
@ 2012-04-23 15:41 Marcin Szewczyk
2012-04-23 17:07 ` Ted Ts'o
2012-04-25 7:56 ` Karel Zak
0 siblings, 2 replies; 4+ messages in thread
From: Marcin Szewczyk @ 2012-04-23 15:41 UTC (permalink / raw)
To: util-linux
Hi,
I have a system with most of the files on one disk. Sometimes an
additional storage is added by inserting another disk. There is an
application included in this system to setup a disk for that additional
storage. It lets a user choose any disk from the pool of not mounted
drives.
The system has been cloned (with dd) to many disks inserted to many
machines. From time to time someone inserts an additional disk which has
been previously used as the system disk. Then there are two filesystems
with same UUIDs inserted to one machine.
The mentioned application uses findmnt to blacklist drives with any
partitions mounted.
Findmnt seems to use links from /dev/disk/by-uuid. There is only one
link for every UUID and it leads to the last detected disk with that
UUID. It causes my application to let the user choose the mounted root
filesystem.
As a workaround I use /proc/self/mountinfo as it gives me major and
minor numbers.
My question is: is there a way to force findmnt to use major and minor
numbers from /proc/self/mountinfo to identify disks/partitions?
Example (using only one disk):
# findmnt -cnko SOURCE /media/sdd
/dev/sdd2
# cat /proc/self/mountinfo | grep sdd
31 19 8:49 / /media/sdd rw,relatime - ext4 /dev/disk/by-uuid/a1d15a89-470a-4a1e-a763-20d4b404d507 rw,user_xattr,barrier=1,data=ordered
# blkid | grep sdd
/dev/sdd1: UUID="a1d15a89-470a-4a1e-a763-20d4b404d507" TYPE="ext4"
/dev/sdd2: UUID="a1d15a89-470a-4a1e-a763-20d4b404d507" TYPE="ext4"
# ls -la /dev/sdd*
brw-rw---T 1 root floppy 8, 48 Apr 23 16:13 /dev/sdd
brw-rw---T 1 root floppy 8, 49 Apr 23 16:13 /dev/sdd1
brw-rw---T 1 root floppy 8, 50 Apr 23 16:20 /dev/sdd2
--
Marcin Szewczyk http://wodny.org
mailto:Marcin.Szewczyk@wodny.borg <- remove b / usuń b
xmpp:wodny@ubuntu.pl xmpp:wodny@jabster.pl
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Duplicate UUIDs, findmnt, /dev/disk/by-uuid
2012-04-23 15:41 Duplicate UUIDs, findmnt, /dev/disk/by-uuid Marcin Szewczyk
@ 2012-04-23 17:07 ` Ted Ts'o
2012-04-25 7:56 ` Karel Zak
1 sibling, 0 replies; 4+ messages in thread
From: Ted Ts'o @ 2012-04-23 17:07 UTC (permalink / raw)
To: Marcin Szewczyk; +Cc: util-linux
On Mon, Apr 23, 2012 at 05:41:06PM +0200, Marcin Szewczyk wrote:
>
> The system has been cloned (with dd) to many disks inserted to many
> machines. From time to time someone inserts an additional disk which has
> been previously used as the system disk. Then there are two filesystems
> with same UUIDs inserted to one machine.
This probably won't help you that much now, but best practice for
ext[234] file systems is after you clone them using dd, you should run
the command "tune2fs -U random /dev/sdXX" to reset the UUID to a new
random value. For XFS, the command is "xfs_admin -U generate /dev/sdXX".
For ntfs, the advanced utilities have a --new-serial option to ntfslabel.
It's *always* a good idea to make sure that the UUID is reset after
cloning a file system, to avoid this sort of problem.
Regards,
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Duplicate UUIDs, findmnt, /dev/disk/by-uuid
2012-04-23 15:41 Duplicate UUIDs, findmnt, /dev/disk/by-uuid Marcin Szewczyk
2012-04-23 17:07 ` Ted Ts'o
@ 2012-04-25 7:56 ` Karel Zak
2012-04-26 7:52 ` Marcin Szewczyk
1 sibling, 1 reply; 4+ messages in thread
From: Karel Zak @ 2012-04-25 7:56 UTC (permalink / raw)
To: Marcin Szewczyk; +Cc: util-linux
On Mon, Apr 23, 2012 at 05:41:06PM +0200, Marcin Szewczyk wrote:
> As a workaround I use /proc/self/mountinfo as it gives me major and
> minor numbers.
>
> My question is: is there a way to force findmnt to use major and minor
> numbers from /proc/self/mountinfo to identify disks/partitions?
Implemented (in upstream tree).
$ findmnt 8:1
TARGET SOURCE FSTYPE OPTIONS
/boot/efi /dev/sda1 vfat rw,relatime,fmask=0077,dmask=0077,codepage=cp437,ioch
(or with "--source 8:1" option to make it more explicit)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Duplicate UUIDs, findmnt, /dev/disk/by-uuid
2012-04-25 7:56 ` Karel Zak
@ 2012-04-26 7:52 ` Marcin Szewczyk
0 siblings, 0 replies; 4+ messages in thread
From: Marcin Szewczyk @ 2012-04-26 7:52 UTC (permalink / raw)
To: util-linux
On Wed, Apr 25, 2012 at 09:56:28AM +0200, Karel Zak wrote:
> Implemented (in upstream tree).
>
> $ findmnt 8:1
> TARGET SOURCE FSTYPE OPTIONS
> /boot/efi /dev/sda1 vfat rw,relatime,fmask=0077,dmask=0077,codepage=cp437,ioch
>
>
> (or with "--source 8:1" option to make it more explicit)
BTW, I've completely missed the MAJ:MIN functionality at first. I've
filed a bug report[1] to Debian mount package to mention the MAJ:MIN
column.
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670273
--
Marcin Szewczyk http://wodny.org
mailto:Marcin.Szewczyk@wodny.borg <- remove b / usuń b
xmpp:wodny@ubuntu.pl xmpp:wodny@jabster.pl
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-26 7:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 15:41 Duplicate UUIDs, findmnt, /dev/disk/by-uuid Marcin Szewczyk
2012-04-23 17:07 ` Ted Ts'o
2012-04-25 7:56 ` Karel Zak
2012-04-26 7:52 ` Marcin Szewczyk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.