1 A RAID1 device cannot be mounted using its LABEL in /etc/fstab: mount says
2 there's more than one partition with that label and bails out.
4 --- util-linux-2.11y/mount/linux_fs.h.skipraid2 2002-10-07 09:08:22.000000000 -0400
5 +++ util-linux-2.11y/mount/linux_fs.h 2003-01-13 14:42:57.000000000 -0500
10 +#include <inttypes.h>
12 +#include <sys/ioctl.h>
13 +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(uint64_t))
16 #define MINIX_SUPER_MAGIC 0x137F /* minix v1, 14 char names */
17 #define MINIX_SUPER_MAGIC2 0x138F /* minix v1, 30 char names */
18 #define MINIX2_SUPER_MAGIC 0x2468 /* minix v2, 14 char names */
19 --- util-linux-2.11y/mount/get_label_uuid.c.skipraid2 2003-01-13 14:44:04.000000000 -0500
20 +++ util-linux-2.11y/mount/get_label_uuid.c 2003-01-13 14:46:34.000000000 -0500
26 +#include <sys/stat.h>
29 #include "get_label_uuid.h"
31 * not on the disks that form the raid array. This test causes a lot of
32 * problems when run on my striped promise fasttrak 100 array."
35 -is_raid_partition(int fd) {
37 - struct mdp_super_block mdsb;
40 - /* hardcode 4096 here in various places, because that's
41 - what it's defined to be. Note that even if we used
42 - the actual kernel headers, sizeof(mdp_super_t) is
43 - slightly larger in the 2.2 kernel on 64-bit archs,
44 - so using that wouldn't work. */
45 - lseek(fd, -4096, SEEK_END); /* Ignore possible error
46 - about return value overflow */
48 - if (sizeof(mdsb) < n)
50 - if (read(fd, &mdsb, n) != n)
51 - return 1; /* error */
52 - return (mdsbmagic(mdsb) == MD_SB_MAGIC);
54 +#if BYTE_ORDER == BIG_ENDIAN
55 +#define INT32_FROM_LE(val) ((unsigned int) ( \
56 + (((unsigned int) (val) & (unsigned int) 0x000000ffU) << 24) | \
57 + (((unsigned int) (val) & (unsigned int) 0x0000ff00U) << 8) | \
58 + (((unsigned int) (val) & (unsigned int) 0x00ff0000U) >> 8) | \
59 + (((unsigned int) (val) & (unsigned int) 0xff000000U) >> 24)))
62 +#define INT32_FROM_LE(val) (val)
66 + unsigned int md_magic;
69 +#define MD_SB_MAGIC 0xa92b4efc
71 +#ifndef MD_RESERVED_BYTES
72 +#define MD_RESERVED_BYTES 65536L
74 +#ifndef MD_NEW_SIZE_BYTES
75 +#define MD_NEW_SIZE_BYTES(x) ((x & ~(MD_RESERVED_BYTES - 1L)) - MD_RESERVED_BYTES)
79 +is_raid_partition(int fd)
84 + if(fstat(fd, &sbuf))
88 + unsigned int bsize32;
89 + if(!ioctl(fd, BLKGETSIZE64, &bsize64))
90 + sbuf.st_size = bsize64;
91 + else if(!ioctl(fd, BLKGETSIZE, &bsize32))
92 + sbuf.st_size = bsize32;
94 + if(!sbuf.st_size) return 3;
95 + /* hardcode 4096 here in various places,
96 + because that's what it's defined to be.
97 + Note that even if we used the actual kernel headers,
98 + sizeof(mdp_super_t) is slightly larger in the 2.2 kernel on 64-bit
99 + archs, so using that wouldn't work. */
100 + lseek(fd, MD_NEW_SIZE_BYTES(sbuf.st_size), SEEK_SET);
101 + n = 4096; if(sizeof(mdsb) < n) n = sizeof(mdsb);
102 + if(read(fd, &mdsb, n) != n)
103 + return 4; /* error */
104 + mdsb.md_magic = INT32_FROM_LE(mdsb.md_magic);
105 + return (mdsb.md_magic == MD_SB_MAGIC); /* If this device has a
107 + the end, it must be
112 /* for now, only ext2, ext3, xfs, ocfs are supported */