Duplicate UUIDs, findmnt, /dev/disk/by-uuid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx  <- remove b / usuń b
xmpp:wodny@xxxxxxxxx                  xmpp:wodny@xxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux