diff -U3 -N raidtools-20010914/Makefile.in raidtools-20010914-raidsbdump/Makefile.in
--- raidtools-20010914/Makefile.in	2001-08-28 15:26:19.000000000 +0000
+++ raidtools-20010914-raidsbdump/Makefile.in	2002-10-09 03:00:08.000000000 +0000
@@ -21,7 +21,7 @@
 
 SOURCES = 	raidstart.c raidlib.c mkraid.c mkpv.c version.c \
 		parser.c raid_io.c scsi.c configure.in Makefile.in \
-		detect_multipath.c
+		detect_multipath.c raidsbdump.c
 
 INTERNAL_LIBS =	parser.o raidlib.o version.o raid_io.o scsi.o
 
@@ -29,7 +29,7 @@
 		lvm-int.h raidlib.h scsi.h
 
 MANUALS = 	raidstart.8 raidstop.8 raidrun.8 mkraid.8 raid0run.8 mkpv.8 \
-		raidtab.5 raidadd.8 ckraid.8
+		raidtab.5 raidadd.8 ckraid.8 raidsbdump.8
 
 MISC	= 	COPYING configure raid0.conf.sample raid1.conf.sample \
 		raid4.conf.sample raid5.conf.sample raidtab.sample \
@@ -39,7 +39,7 @@
 
 DISTFILES = $(SOURCES) $(HEADERS) $(MANUALS) $(MISC)
 
-BINARIES = raidstart mkraid mkpv detect_multipath
+BINARIES = raidstart mkraid mkpv detect_multipath raidsbdump
 CC = @CC@
 CFLAGS = -O2 -Wall -DMD_VERSION=\""raidtools-@VERS@"\"
 LDFLAGS = @LDFLAGS@ -lpopt
diff -U3 -N raidtools-20010914/parser.h raidtools-20010914-raidsbdump/parser.h
--- raidtools-20010914/parser.h	2001-08-28 15:27:13.000000000 +0000
+++ raidtools-20010914-raidsbdump/parser.h	2002-10-09 02:33:56.000000000 +0000
@@ -9,6 +9,9 @@
  * sources.
  */
 
+#ifndef H_PARSER
+#define H_PARSER
+
 extern int parse_config (FILE *fp);
 
 extern char *parity_algorithm_table[];
@@ -29,3 +32,5 @@
 extern md_cfg_entry_t *cfg_head;
 extern md_cfg_entry_t *cfg;
 extern int force_flag;
+
+#endif
diff -U3 -N raidtools-20010914/raidlib.h raidtools-20010914-raidsbdump/raidlib.h
--- raidtools-20010914/raidlib.h	2001-08-28 15:27:17.000000000 +0000
+++ raidtools-20010914-raidsbdump/raidlib.h	2002-10-09 02:33:14.000000000 +0000
@@ -11,6 +11,8 @@
 #ifndef H_RAIDLIB
 #define H_RAIDLIB
 
+#include "parser.h"
+
 extern int do_quiet_flag;
 
 #define MIN(a,b)	((a) < (b) ? (a) : (b))
diff -U3 -N raidtools-20010914/raidsbdump.8 raidtools-20010914-raidsbdump/raidsbdump.8
--- raidtools-20010914/raidsbdump.8	1970-01-01 00:00:00.000000000 +0000
+++ raidtools-20010914-raidsbdump/raidsbdump.8	2002-10-09 02:53:51.000000000 +0000
@@ -0,0 +1,71 @@
+.\" -*- nroff -*-
+.TH raidsbdump 8
+.SH NAME
+raidsbdump \- examine RAID superblock
+.SH SYNOPSIS
+
+.B raidsbdump
+<raiddevice>*
+
+.SH DESCRIPTION
+
+.B raidsbdump
+dumps out the state of the RAID superblock on a device.
+
+.SH EXAMPLE OUTPUT
+
+Here we dump out a the superblock from what appears to be one half of
+a RAID-1 mirror that would like to be autorun as
+.BR /dev/md0 .
+Running
+.B raidsbdump
+on
+.BR /dev/hda3 ,
+the other half of the mirror, should produce the same output.
+
+.nf
+# ./raidsbdump /dev/hdc3
+MD ID:                   a92b4efc
+Conforms to MD version:  0.90.0
+preferred minor           0 (md0)
+gvalid_words:            0
+Raid set ID:             e723e5dc
+Creation time:           Fri Sep 27 19:35:49 2002
+Update time:             Sat Oct  5 17:59:49 2002
+State:                   0
+Raid level:              1
+Individual disk size:    36101MB (36968320kB)
+Total number of disks:   2
+Number of raid disks:    2
+Number of active disks:  2
+Number of working disks: 2
+Number of failed disks:  0
+Number of spare disks:   0
+
+Disk 0: major 3, minor 3, raid_disk 0, state: 6 (operational, active, sync)
+Disk 1: major 22, minor 3, raid_disk 1, state: 6 (operational, active, sync)
+.fi
+
+.SH OPTIONS
+
+.IP "\fB\-h\fP, \fB\-\-help\fP"
+Displays a short usage message, then exits.
+
+.IP "\fB\-V\fP, \fB\-\-version\fP"
+Displays a short version message, then exits.
+
+.SH NOTES
+
+The raidtools are derived from the md-tools and raidtools packages, which
+were originally written by Marc Zyngier, Miguel de Icaza, Gadi Oxman, 
+Bradley Ward Allen, and Ingo Molnar.
+
+.B raidsbdump
+was written by Michael Shields.
+
+.SH BUGS
+no known bugs.
+
+.SH SEE ALSO
+.BR raidtab (5),
+.BR mkraid (8)
diff -U3 -N raidtools-20010914/raidsbdump.c raidtools-20010914-raidsbdump/raidsbdump.c
--- raidtools-20010914/raidsbdump.c	1970-01-01 00:00:00.000000000 +0000
+++ raidtools-20010914-raidsbdump/raidsbdump.c	2002-10-09 02:38:22.000000000 +0000
@@ -0,0 +1,129 @@
+/*
+   raidsbdump.c : Multiple Devices tools for Linux
+	       Copyright (C) 2001-2002 Michael Shields
+	       <shields@msrl.com>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   You should have received a copy of the GNU General Public License
+   (for example /usr/src/linux/COPYING); if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+*/
+
+#include "common.h"
+#include "popt.h"
+#include "raid_io.h"
+
+#include <sys/mount.h>          /* for BLKGETSIZE */
+#ifndef BLKGETSIZE
+#include <linux/fs.h>          /* for BLKGETSIZE */
+#endif
+
+#define RAIDSBDUMP_VERSION	"0.10"
+
+void usage (void)
+{
+    printf("usage: raidsbdump [--version] </dev/*>*\n");
+}
+
+int raidsbdump (char *dev)
+{
+    int fd;
+    unsigned long blocks;
+    unsigned long offset;
+    char buffer[MD_SB_BYTES];
+
+    fd = open(dev, O_RDONLY);
+    if (fd == -1) {
+	fprintf(stderr, "raidsbdump: couldn't open device %s: %s\n ",
+		dev, strerror(errno));
+	return 1;
+    }
+
+    if (ioctl(fd, BLKGETSIZE, &blocks) == -1) {
+	fprintf(stderr, "raidsbdump: couldn't get block size of %s: %s\n",
+		dev, strerror(errno));
+	close(fd);
+	return 1;
+    }
+    /* 512-byte POSIX blocks vs. 1024-byte md blocks. */
+    offset = MD_NEW_SIZE_BLOCKS((blocks / 2));
+
+    if (raidseek(fd, offset) == -1) {
+	fprintf(stderr, "raidsbdump: couldn't seek on %s: %s\n",
+		dev, strerror(errno));
+	close(fd);
+	return 1;
+    }
+    if ((read(fd, buffer, MD_SB_BYTES)) != MD_SB_BYTES) {
+	fprintf(stderr, "raidsbdump: couldn't read superblock of %s: %s\n",
+		dev, strerror(errno));
+	close(fd);
+	return 1;
+    }
+
+    if (((md_superblock_t *) &buffer)->md_magic != MD_SB_MAGIC) {
+	fprintf(stderr, "raidsbdump: bad magic on %s\n", dev);
+	close(fd);
+	return 1;
+    }
+
+    print_sb((md_superblock_t *) &buffer);
+
+    return 0;
+}
+
+int main (int argc, char *argv[])
+{
+    int help = 0;
+    int version = 0;
+    char ** args;
+    poptContext optCon;
+    int i;
+    struct poptOption optionsTable[] = {
+	{ "help", 'h', 0, &help, 0 },
+	{ "version", 'V', 0, &version, 0 },
+	{ NULL, 0, 0, NULL, 0 }
+    };
+    int exit_value = 0;
+
+    optCon = poptGetContext("raidsbdump", argc, (const char **)argv,
+			    optionsTable, 0);
+    if ((i = poptGetNextOpt(optCon)) < -1) {
+	fprintf(stderr, "%s: %s\n", 
+		poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
+		poptStrerror(i));
+	usage();
+	return EXIT_FAILURE;
+    }
+
+    if (help) {
+	usage();
+	return EXIT_FAILURE;
+    }
+
+    if (version) {
+	printf("raidsbdump " RAIDSBDUMP_VERSION " compiled for "
+	       MD_VERSION "\n");
+	return EXIT_VERSION;
+    }
+
+    args = (char **)poptGetArgs(optCon);
+    if (!args) {
+	fprintf(stderr, "nothing to do!\n");
+	usage();
+	return EXIT_FAILURE;
+    }
+
+    while (*args) {
+	exit_value += raidsbdump(*args);
+	args++;
+    }
+
+    return exit_value;
+}
+
+
Common subdirectories: raidtools-20010914/Software-RAID.HOWTO and raidtools-20010914-raidsbdump/Software-RAID.HOWTO
