[DRBD-user] OpenSSI-DRBD integration: proposed solution for mount UUID

Lars Ellenberg Lars.Ellenberg at linbit.com
Thu Feb 12 15:39:09 CET 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2004-02-12 14:33:56 +0100
\ Lars Marowsky-Bree:
> On 2004-02-12T13:52:23,
>    Lars Ellenberg <Lars.Ellenberg at linbit.com> said:
> 
> > (A)
> > So maybe you have to hack up mount, to have it look at /dev/nbX
> > first whenever you specify a UUID, regardless of whether they show
> > up in /proc/partitions or not (or add a /etc/partitions to be
> > read in first, to have this more flexible) ...
> 
> Well, md raid1 is also transparent at the beginning of the device, and
> still mount knows to mount the /dev/md0 and not the physical device. I
> suggest using the same mechanism, whatever it is ;-)

#-----------------
/etc/raidtab:
raiddev /dev/md0
	raid-level              1
	nr-raid-disks           2
	persistent-superblock   0
	chunk-size              8

	device                  /dev/LVM-minna/sven-500
	raid-disk               0
	device                  /dev/LVM-minna/olaf-500
	raid-disk               1
#-----------------
mkraid /dev/md0
#-----------------
grep "..." /proc/partitions
  58     8     512000 lvmi 0 0 0 0 0 0 0 0 0 0 0
  58     9     512000 lvmj 0 0 0 0 0 0 0 0 0 0 0
   9     0     512000 md0 0 0 0 0 0 0 0 0 0 0 0
#-----------------
mke2fs -j /dev/md0
#-----------------
# dumpe2fs  -h /dev/md0  | grep ^Filesystem
dumpe2fs 1.34 (25-Jul-2003)
Filesystem volume name:   <none>
Filesystem UUID:          1663399d-83cb-47e4-9916-20bf8d7c4678
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal filetype sparse_super
Filesystem state:         clean
Filesystem OS type:       Linux
Filesystem created:       Thu Feb 12 13:35:48 2004
#-----------------
# dumpe2fs  -h /dev/LVM-minna/sven-500  | grep ^Filesystem
dumpe2fs 1.34 (25-Jul-2003)
Filesystem volume name:   <none>
Filesystem UUID:          1663399d-83cb-47e4-9916-20bf8d7c4678
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal filetype sparse_super
Filesystem state:         clean
Filesystem OS type:       Linux
Filesystem created:       Thu Feb 12 13:35:48 2004
#-----------------
# dumpe2fs  -h /dev/LVM-minna/olaf-500  | grep ^Filesystem
dumpe2fs 1.34 (25-Jul-2003)
Filesystem volume name:   <none>
Filesystem UUID:          1663399d-83cb-47e4-9916-20bf8d7c4678
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal filetype sparse_super
Filesystem state:         clean
Filesystem OS type:       Linux
Filesystem created:       Thu Feb 12 13:35:48 2004
#-----------------

hm. you are so very sure that you mean what you say?

ok, lets see:
# mount -v -U 1663399d-83cb-47e4-9916-20bf8d7c4678 /mnt
mount: mounting /dev/md0
mount: you didn't specify a filesystem type for /dev/md0
       I will try type ext3
/dev/md0 on /mnt type ext3 (rw)

#-----------------

so why does it work?

rpm -Uhv util-linux.src.rpm
rpmbuild -bp util-linux.spec

mount/mount_by_label.c:
    184
    185                 /* look only at md devices on first pass */
    186                 handleOnFirst = !strncmp(ptname, "md", 2);
    187                 if (firstPass != handleOnFirst)
    188                         continue;
    189

there you are.

so please:
# patch -p0 mount_by_label.c <<___
--- mount_by_label.c.orig	2004-02-12 15:30:44.000000000 +0100
+++ mount_by_label.c	2004-02-12 15:30:35.000000000 +0100
@@ -182,8 +182,9 @@
 		if (sz == 1)
 			continue;
 
-		/* look only at md devices on first pass */
-		handleOnFirst = !strncmp(ptname, "md", 2);
+		/* look only at md or nbd devices on first pass */
+		handleOnFirst = !strncmp(ptname, "md", 2) ||
+				!strncmp(ptname, "nb", 2);
 		if (firstPass != handleOnFirst)
 			continue;
___ 


still to do:
register a gendisk with kernel 2.4.X, to have ti show up in /proc/partitions
but you could easily just add a "very first" pass, where you only scan nbd.
which is what I'd do anyways, because drbd (nbd) may well sit on
top of md.

so, since it turns out that you have to hack up mmount anyways,
just do it, and check for nbX first, maybe before even reading
/proc/partitions.

Have fun,

	Lars Ellenberg



More information about the drbd-user mailing list