-
+Changed Prior to 0.8 release
+ - update mdadm.spec
+ - use BLKGETSIZE64 if available for array size
+ - give human readable as GiB/MiB and GB and MB, with 2 decimal point precision
+ - Only warn about size variation for raid1/4/5.
+ - Started md.4 man page
+ - Started mdadm.conf.5 man page
+
Changes Prior to 0.7 release
- Fix makefile to install binary at /sbin and not /sbin/sbin
if (verbose && level>0)
fprintf(stderr, Name ": size set to %dK\n", size);
}
- if ((maxsize-size)*100 > maxsize) {
+ if (level >= 1 && ((maxsize-size)*100 > maxsize)) {
fprintf(stderr, Name ": largest drive (%s) exceed size (%dK) by more than 1%\n",
maxdisc, size);
warn = 1;
if (brief)
printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks );
else {
- int array_size;
- if (ioctl(fd, BLKGETSIZE, &array_size))
- array_size = 0;
- else array_size>>= 1;
+ long array_size;
+ long long larray_size;
+ if (ioctl(fd, BLKGETSIZE64, &larray_size)==0)
+ ;
+ else if (ioctl(fd, BLKGETSIZE, &array_size)==0)
+ larray_size = array_size<<9;
+ else larray_size = 0;
+
printf("%s:\n", dev);
printf(" Version : %02d.%02d.%02d\n",
array.major_version, array.minor_version, array.patch_version);
atime = array.ctime;
printf(" Creation Time : %.24s\n", ctime(&atime));
printf(" Raid Level : %s\n", c?c:"-unknown-");
- if (array_size)
- printf(" Array Size : %d%s\n", array_size, human_size(array_size));
+ if (larray_size)
+ printf(" Array Size : %ld%s\n", (long)(larray_size>>10), human_size(larray_size));
if (array.level >= 1)
- printf(" Device Size : %d%s\n", array.size, human_size(array.size));
+ printf(" Device Size : %d%s\n", array.size, human_size((long long)array.size<<10));
printf(" Raid Disks : %d\n", array.raid_disks);
printf(" Total Disks : %d\n", array.nr_disks);
printf("Preferred Minor : %d\n", array.md_minor);
printf(" Creation Time : %.24s\n", ctime(&atime));
c=map_num(pers, super.level);
printf(" Raid Level : %s\n", c?c:"-unknown-");
- printf(" Device Size : %d%s\n", super.size, human_size(super.size));
+ printf(" Device Size : %d%s\n", super.size, human_size((long long)super.size<<10));
printf(" Raid Disks : %d\n", super.raid_disks);
printf(" Total Disks : %d\n", super.nr_disks);
printf("Preferred Minor : %d\n", super.md_minor);
OBJS = mdadm.o config.o ReadMe.o util.o Manage.o Assemble.o Build.o Create.o Detail.o Examine.o Monitor.o dlink.o Kill.o
-all : mdadm mdadm.man
+all : mdadm mdadm.man md.man mdadm.conf.man
mdadm : $(OBJS)
$(CC) -o mdadm $^
mdadm.man : mdadm.8
nroff -man mdadm.8 > mdadm.man
+md.man : md.4
+ nroff -man md.4 > md.man
+
+mdadm.conf.man : mdadm.conf.5
+ nroff -man mdadm.conf.5 > mdadm.conf.man
+
$(OBJS) : mdadm.h
install : mdadm mdadm.8
#include "mdadm.h"
-char Version[] = Name " - v0.7 - 8 March 2002\n";
+char Version[] = Name " - v0.7.1 - 8 March 2002\n";
/*
* File: ReadMe.c
*
?? Allow -S /dev/md? - current complains subsequent not a/d/r
+* new "Query" mode to subsume --detail and --examine.
+ --query or -Q, takes a device and tells if it is an MD device,
+ and also tells in a raid superblock is found.
+
* write proc.c to parse /proc/mdstat file, and maybe /proc/partitions too.
Build list of arrays: name, rebuild-percent
fi
set `grep '^char Version' ReadMe.c `
version=`echo $7 | sed 's/v//'`
+grep "^Version: $version$" mdadm.spec > /dev/null 2>&1 ||
+ {
+ echo mdadm.conf does not mention version $version.
+ exit 1
+ }
echo version = $version
base=mdadm-$version.tgz
if [ -f $target/$base ]
--- /dev/null
+.TH MD 4
+.SH NAME
+md \- Multiple Device driver aka Linux Software Raid
+.SH SYNOPSIS
+.BI /dev/md n
+.br
+.BI /dev/md/ n
+.SH DESCRIPTION
+The
+.B md
+driver provides virtual devices that are created from one or more
+independant underlying devices. This array of devices often contains
+redundancy, and hence the acronym RAID which stands for a Redundant
+Array of Independant Devices.
+.PP
+.B md
+support RAID levels 1 (mirroring) 4 (striped array with parity device) and 5
+(striped array with distributed parity information. If a single underlying
+device fails while using one of these level, they array will continue
+to function.
+.PP
+.B md
+also supports a number of pseudo RAID (non-redundant) configuations
+including RAID0 (striped array), LINEAR (catenated array) and
+MULTIPATH (a set of different interfaces to the same device).
+
+.SS RAID SUPER BLOCK
+With the exception of Legacy Arrays described below, each device that
+is incorportated into an MD array has a
+.I super block
+written towards the end of the device. This superblock records
+information about the structure and state of the array so that the
+array an be reliably re-assembled after a shutdown.
+
+The superblock is 4K long and is written into a 64K aligned block that
+start at least 64K and less than 128K from the end of the device
+(i.e. to get the address of the superblock round the size of the
+device down to a multiple of 64K and then subtract 64K).
+The available size of each device is the ammount of space before the
+super block, so between 64K and 128K is lost when a device in
+incorporated into an MD array.
+
+The superblock contains, among other things:
+.TP
+LEVEL
+The
+.TP
+UUID
+a 128 bit Universally Unique Identifier that identifies the array that
+this device is part of.
+
+.SS LINEAR
+.SS RAID0
+.SS RAID1
+.SS RAID4
+.SS RAID5
+.SS REBUILD/RESYNC
+.SH FILES
+.TP
+.B /proc/mdstat
+Contains information about the status of currently running array.
+.TP
+.B /proc/sys/dev/raid/speed_limit_min
+A readable and writable file that reflects the current goal rebuild
+speed for times when non-rebuild activity is current on an array.
+The speed is in Kibibytes per second, and is a per-device rate, not a
+per-array rate (which means that an array with more disc will shuffle
+more data for a given speed). The default is 100.
+
+.TP
+.B /proc/sys/dev/raid/speed_limit_max
+A readable and writable file that reflects the current goal rebuild
+speed for times when no non-rebuild activity is current on an array.
+The default is 100,000.
+
+.SH SEE ALSO
+.BR mdadm (8),
+.BR mkraid (8).
--- /dev/null
+MD(4) MD(4)
+
+
+
+N\bNA\bAM\bME\bE
+ md - Multiple Device driver aka Linux Software Raid
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ /\b/d\bde\bev\bv/\b/m\bmd\bd_\bn
+ /\b/d\bde\bev\bv/\b/m\bmd\bd/\b/_\bn
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmd\bd driver provides virtual devices that are created
+ from one or more independant underlying devices. This
+ array of devices often contains redundancy, and hence the
+ acronym RAID which stands for a Redundant Array of Inde-
+ pendant Devices.
+
+ m\bmd\bd support RAID levels 1 (mirroring) 4 (striped array with
+ parity device) and 5 (striped array with distributed par-
+ ity information. If a single underlying device fails
+ while using one of these level, they array will continue
+ to function.
+
+ m\bmd\bd also supports a number of pseudo RAID (non-redundant)
+ configuations including RAID0 (striped array), LINEAR
+ (catenated array) and MULTIPATH (a set of different inter-
+ faces to the same device).
+
+
+ R\bRA\bAI\bID\bD S\bSU\bUP\bPE\bER\bR B\bBL\bLO\bOC\bCK\bK
+ With the exception of Legacy Arrays described below, each
+ device that is incorportated into an MD array has a _\bs_\bu_\bp_\be_\br
+ _\bb_\bl_\bo_\bc_\bk written towards the end of the device. This
+ superblock records information about the structure and
+ state of the array so that the array an be reliably re-
+ assembled after a shutdown.
+
+ The superblock is 4K long and is written into a 64K
+ aligned block that start at least 64K and less than 128K
+ from the end of the device (i.e. to get the address of the
+ superblock round the size of the device down to a multiple
+ of 64K and then subtract 64K). The available size of each
+ device is the ammount of space before the super block, so
+ between 64K and 128K is lost when a device in incorporated
+ into an MD array.
+
+ The superblock contains, among other things:
+
+ LEVEL The
+
+ UUID a 128 bit Universally Unique Identifier that iden-
+ tifies the array that this device is part of.
+
+
+ L\bLI\bIN\bNE\bEA\bAR\bR
+ R\bRA\bAI\bID\bD0\b0
+ R\bRA\bAI\bID\bD1\b1
+ R\bRA\bAI\bID\bD4\b4
+ R\bRA\bAI\bID\bD5\b5
+ R\bRE\bEB\bBU\bUI\bIL\bLD\bD/\b/R\bRE\bES\bSY\bYN\bNC\bC
+F\bFI\bIL\bLE\bES\bS
+ /\b/p\bpr\bro\boc\bc/\b/m\bmd\bds\bst\bta\bat\bt
+ Contains information about the status of currently
+ running array.
+
+ /\b/p\bpr\bro\boc\bc/\b/s\bsy\bys\bs/\b/d\bde\bev\bv/\b/r\bra\bai\bid\bd/\b/s\bsp\bpe\bee\bed\bd_\b_l\bli\bim\bmi\bit\bt_\b_m\bmi\bin\bn
+ A readable and writable file that reflects the cur-
+ rent goal rebuild speed for times when non-rebuild
+ activity is current on an array. The speed is in
+ Kibibytes per second, and is a per-device rate, not
+ a per-array rate (which means that an array with
+ more disc will shuffle more data for a given
+ speed). The default is 100.
+
+
+ /\b/p\bpr\bro\boc\bc/\b/s\bsy\bys\bs/\b/d\bde\bev\bv/\b/r\bra\bai\bid\bd/\b/s\bsp\bpe\bee\bed\bd_\b_l\bli\bim\bmi\bit\bt_\b_m\bma\bax\bx
+ A readable and writable file that reflects the cur-
+ rent goal rebuild speed for times when no non-
+ rebuild activity is current on an array. The
+ default is 100,000.
+
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ m\bmd\bda\bad\bdm\bm(8), m\bmk\bkr\bra\bai\bid\bd(8).
+
+
+
+ MD(4)
http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
.URk
.PP
+.BR mdadm.conf (5),
+.BR md (4).
+.PP
.IR raidtab (5),
.IR raid0run (8),
.IR raidstop (8),
}
switch(level) {
default:
- fprintf(stderr, Name ": layout now meaningful for %s arrays.\n",
+ fprintf(stderr, Name ": layout not meaningful for %s arrays.\n",
map_num(pers, level));
exit(2);
case -10:
--- /dev/null
+# mdadm configuration file
+#
+# mdadm will function properly without the use of a configuration file,
+# but this file is useful for keeping track of arrays and member disks.
+# In general, a mdadm.conf file is created, and updated, after arrays
+# are created. This is the opposite behavior of /etc/raidtab which is
+# created prior to array construction.
+#
+#
+# the config file takes two types of lines:
+#
+# DEVICE lines specify a list of devices of where to look for
+# potential member disks
+#
+# ARRAY lines specify information about how to identify arrays so
+# so that they can be activated
+#
+# You can have more than one device line and use wild cards. The first
+# example includes SCSI the first partition of SCSI disks /dev/sdb,
+# /dev/sdc, /dev/sdd, /dev/sdj, /dev/sdk, and /dev/sdl. The second
+# line looks for array slices on IDE disks.
+#
+#DEVICE /dev/sd[bcdjkl]1
+#DEVICE /dev/hda1 /dev/hdb1
+#
+#
+#
+# ARRAY lines specify an array to assemble and a method of identification.
+# Arrays can currently be identified by using a UUID, superblock minor number,
+# or a listing of devices.
+#
+# super-minor is usally the minor number of the metadevice
+# UUID is the Universally Unique Identifier for the array
+# Each can be obtained using
+#
+# mdadm -D <md>
+#
+#ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
+#ARRAY /dev/md1 superminor=1
+#ARRAY /dev/md2 devices=/dev/hda1,/dev/hda2
--- /dev/null
+.TH MDADM.CONF 5
+.SH NAME
+mdadm.conf \- configuration for management of Software Raid with mdadm
+.SH SYNOPSIS
+/etc/mdadm.conf
+.SH DESCRIPTION
+.PP
+.B mdadm
+is a tools for creating an managing RAID devices using the
+.B md
+driver in Linux.
+.PP
+Some common tasks, such as assembling all arrays, can be simplified
+by describing the devices and array in this configuations file.
+
+.SS SYNTAX
+The file should be seen as a collection of words separated by white
+space (space, tab, or newline).
+Any word that being with a hash sign (#) starts a comment and that
+word together with the remainder of the line are ignored.
+
+Any line that start with white space (space or tab) is treated as
+though it were a continuation of the previous line.
+
+Empty lines are ignored, but otherwise each (non continuation) line
+must start with a keyword as listed below. The key words are case
+insensitve and can be abbreviated to 3 characters.
+
+The keywords are:
+.TP
+.B DEVICE
+A
+.B device
+line lists the devices (whole devices or partitions) that might contain
+a component of an MD array. When looking for the components of an
+array,
+.B mdadm
+will scan these devices and no others.
+
+The
+.B device
+line may contain a number of different devices (separated by spaces)
+and each device name can contain wild cards as defined by
+.BR glob (7).
+
+Also, there may be several device lines present in the file.
+
+.TP
+.B ARRAY
+
+.SH SEE ALSO
+mdadm (8),
+md (4).
+
--- /dev/null
+MDADM.CONF(5) MDADM.CONF(5)
+
+
+
+N\bNA\bAM\bME\bE
+ mdadm.conf - configuration for management of Software Raid
+ with mdadm
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ /etc/mdadm.conf
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ m\bmd\bda\bad\bdm\bm is a tools for creating an managing RAID devices
+ using the m\bmd\bd driver in Linux.
+
+ Some common tasks, such as assembling all arrays, can be
+ simplified by describing the devices and array in this
+ configuations file.
+
+
+ S\bSY\bYN\bNT\bTA\bAX\bX
+ The file should be seen as a collection of words separated
+ by white space (space, tab, or newline). Any word that
+ being with a hash sign (#) starts a comment and that word
+ together with the remainder of the line are ignored.
+
+ Any line that start with white space (space or tab) is
+ treated as though it were a continuation of the previous
+ line.
+
+ Empty lines are ignored, but otherwise each (non continua-
+ tion) line must start with a keyword as listed below. The
+ key words are case insensitve and can be abbreviated to 3
+ characters.
+
+ The keywords are:
+
+ D\bDE\bEV\bVI\bIC\bCE\bE A d\bde\bev\bvi\bic\bce\be line lists the devices (whole devices or
+ partitions) that might contain a component of an MD
+ array. When looking for the components of an
+ array, m\bmd\bda\bad\bdm\bm will scan these devices and no others.
+
+ The d\bde\bev\bvi\bic\bce\be line may contain a number of different
+ devices (separated by spaces) and each device name
+ can contain wild cards as defined by g\bgl\blo\bob\bb(7).
+
+ Also, there may be several device lines present in
+ the file.
+
+
+ A\bAR\bRR\bRA\bAY\bY
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mdadm (8), md (4).
+
+
+
+
+ MDADM.CONF(5)
#include <sys/ioctl.h>
#define MD_MAJOR 9
+/* I seem to need this to make BLKGETSIZE64 to work... */
+#define u64 __u64
+
#include "md_u.h"
extern mddev_ident_t conf_get_ident(char *, char*);
extern mddev_dev_t conf_get_devs(char *);
-extern char *human_size(long kbytes);
+extern char *human_size(long long bytes);
+++ /dev/null
-mdadm(8) mdadm(8)
-
-
-
-N\bNA\bAM\bME\bE
- mdadm - manage MD devices _\ba_\bk_\ba Linux Software Raid.
-
-
-S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
- m\bmd\bda\bad\bdm\bm _\b[_\bm_\bo_\bd_\be_\b] _\b<_\br_\ba_\bi_\bd_\bd_\be_\bv_\bi_\bc_\be_\b> _\b[_\bo_\bp_\bt_\bi_\bo_\bn_\bs_\b] _\b<_\bs_\bu_\bb_\bd_\be_\bv_\bi_\bc_\be_\bs_\b>
-
-
-D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
- RAID devices are virtual devices created from two or more
- real block devices. This allows multiple devices (typi-
- cally disk drives or partitions there-of) to be combined
- into a single device to hold (for example) a single
- filesystem. Some RAID levels included redundancy and so
- can survive some degree of device failure.
-
- Linux Software RAID devices are implemented through the md
- (Multiple Devices) device driver.
-
- Currently, Linux supports L\bLI\bIN\bNE\bEA\bAR\bR md devices, R\bRA\bAI\bID\bD0\b0 (strip-
- ing), R\bRA\bAI\bID\bD1\b1 (mirroring), R\bRA\bAI\bID\bD4\b4 and R\bRA\bAI\bID\bD5\b5.\b.
-
- Recent kernels (2002) also support a mode known as M\bMU\bUL\bLT\bTI\bI-\b-
- P\bPA\bAT\bTH\bH. m\bmd\bda\bad\bdm\bm does not support MULTIPATH as yet.
-
- m\bmd\bda\bad\bdm\bm is a program that can be used to create and manage
- MD devices. As such it provides a similar set of func-
- tionality to the r\bra\bai\bid\bdt\bto\boo\bol\bls\bs packages. The key differences
- between m\bmd\bda\bad\bdm\bm and r\bra\bai\bid\bdt\bto\boo\bol\bls\bs are:
-
- +\bo m\bmd\bda\bad\bdm\bm is a single program and not a collection of pro-
- grams.
-
- +\bo m\bmd\bda\bad\bdm\bm can perform (almost) all of its functions with-
- out having a configuration file. Also mdadm helps
- with management of the configuration file.
-
- +\bo m\bmd\bda\bad\bdm\bm can provide information about your arrays
- (through Detail and Examine) that r\bra\bai\bid\bdt\bto\boo\bol\bls\bs cannot.
-
- +\bo r\bra\bai\bid\bdt\bto\boo\bol\bls\bs can manage MULTIPATH devices which m\bmd\bda\bad\bdm\bm
- cannot yet manage.
-
-
-M\bMO\bOD\bDE\bES\bS
- mdadm has 7 major modes of operation:
-
- A\bAs\bss\bse\bem\bmb\bbl\ble\be
- Assemble the parts of a previously created array
- into an active array. Components can be explicitly
- given or can be searched for. m\bmd\bda\bad\bdm\bm checks that
- the components do form a bona fide array, and can,
- on request, fiddle superblock information so as to
- assemble a faulty array.
-
-
- B\bBu\bui\bil\bld\bd Build a legacy array without per-device
- superblocks.
-
-
- C\bCr\bre\bea\bat\bte\be Create a new array with per-device superblocks.
-
-
- D\bDe\bet\bta\bai\bil\bl Display the details of a given md device. Details
- include the RAID level, the number of devices,
- which ones are faulty (if any), and the array UUID.
-
-
- E\bEx\bxa\bam\bmi\bin\bne\be
- Examine a device to see if it is part of an md
- array, and print out the details of that array.
- This mode can also be used to examine a large num-
- ber of devices and to print out a summary of the
- arrays found in a format suitable for the
- m\bmd\bda\bad\bdm\bm.\b.c\bco\bon\bnf\bf configuration file.
-
-
- F\bFo\bol\bll\blo\bow\bw o\bor\br M\bMo\bon\bni\bit\bto\bor\br
- Monitor one or more md devices and act on any state
- changes.
-
-
- M\bMa\ban\bna\bag\bge\be This is for odd bits an pieces like hotadd,
- hotremove, setfaulty, stop, readonly, readwrite.
-
-
-O\bOP\bPT\bTI\bIO\bON\bNS\bS
- Available options are:
-
-
- -\b-A\bA, -\b--\b-a\bas\bss\bse\bem\bmb\bbl\ble\be
- Assemble an existing array.
-
-
- -\b-B\bB, -\b--\b-b\bbu\bui\bil\bld\bd
- Build a legacy array without superblocks.
-
-
- -\b-C\bC, -\b--\b-c\bcr\bre\bea\bat\bte\be
- Create a new array.
-
-
- -\b-D\bD, -\b--\b-d\bde\bet\bta\bai\bil\bl
- Print detail of one or more md devices.
-
-
- -\b-E\bE, -\b--\b-e\bex\bxa\bam\bmi\bin\bne\be
- Print content of md superblock on device(s).
-
-
- -\b-F\bF, -\b--\b-f\bfo\bol\bll\blo\bow\bw, -\b--\b-m\bmo\bon\bni\bit\bto\bor\br
- Select M\bMo\bon\bni\bit\bto\bor\br mode.
-
-
- -\b-h\bh, -\b--\b-h\bhe\bel\blp\bp
- Display help message or, after above option, mode
- specific help message.
-
-
- -\b-V\bV, -\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
- Print version information for mdadm.
-
-
- -\b-v\bv, -\b--\b-v\bve\ber\brb\bbo\bos\bse\be
- Be more verbose about what is happening.
-
-
- -\b-b\bb, -\b--\b-b\bbr\bri\bie\bef\bf
- Be less verbose. This is used with -\b--\b-d\bde\bet\bta\bai\bil\bl and
- -\b--\b-e\bex\bxa\bam\bmi\bin\bne\be.
-
-
-F\bFo\bor\br c\bcr\bre\bea\bat\bte\be o\bor\br b\bbu\bui\bil\bld\bd:\b:
- -\b-c\bc, -\b--\b-c\bch\bhu\bun\bnk\bk=\b=
- Specify chunk size of kibibytes. The default is
- 64.
-
-
- -\b--\b-r\bro\bou\bun\bnd\bdi\bin\bng\bg=\b=
- Specify rounding factor for linear array (==chunk
- size)
-
-
- -\b-l\bl, -\b--\b-l\ble\bev\bve\bel\bl=\b=
- Set raid level. Options are: linear, raid0, 0,
- stripe, raid1, 1, mirror, raid5, 4, raid5, 5.
- Obviously some of these are synonymous. Only the
- first 4 are valid when Building.
-
-
- -\b-p\bp, -\b--\b-p\bpa\bar\bri\bit\bty\by=\b=
- Set raid5 parity algorithm. Options are:
- {left,right}-{,a}symmetric, la, ra, ls, rs. The
- default is left-symmetric.
-
-
- -\b--\b-l\bla\bay\byo\bou\but\bt=\b=
- same as --parity
-
-
- -\b-n\bn, -\b--\b-r\bra\bai\bid\bd-\b-d\bdi\bis\bsk\bks\bs=\b=
- number of active devices in array.
-
-
- -\b-x\bx, -\b--\b-s\bsp\bpa\bar\bre\be-\b-d\bdi\bis\bsk\bks\bs=\b=
- number of spare (eXtra) disks in initial array.
- Spares can be added and removed later.
-
-
- -\b-z\bz, -\b--\b-s\bsi\biz\bze\be=\b=
- Amount (in Kibibytes) of space to use from each
- drive in RAID1/4/5. This must be a multiple of the
- chunk size, and must leave about 128Kb of space at
- the end of the drive for the RAID superblock. If
- this is not specified (as it normally is not) the
- smallest drive (or partition) sets the size, though
- if there is a variance among the drives of greater
- than 1%, a warning is issued.
-
-
-F\bFo\bor\br a\bas\bss\bse\bem\bmb\bbl\ble\be:\b:
- -\b-u\bu, -\b--\b-u\buu\bui\bid\bd=\b=
- uuid of array to assemble. Devices which don't have
- this uuid are excluded
-
-
- -\b-m\bm, -\b--\b-s\bsu\bup\bpe\ber\br-\b-m\bmi\bin\bno\bor\br=\b=
- Minor number of device that array was created for.
- Devices which don't have this minor number are
- excluded. If you create an array as /dev/md1, then
- all superblock will contain the minor number 1,
- even if the array is later assembled as /dev/md2.
-
-
- -\b-c\bc, -\b--\b-c\bco\bon\bnf\bfi\big\bg=\b=
- config file. Default is /\b/e\bet\btc\bc/\b/m\bmd\bda\bad\bdm\bm.\b.c\bco\bon\bnf\bf.
-
-
- -\b-s\bs, -\b--\b-s\bsc\bca\ban\bn
- scan config file for missing information
-
-
- -\b-f\bf, -\b--\b-f\bfo\bor\brc\bce\be
- Assemble the array even if some superblocks appear
- out-of-date
-
-
- -\b-R\bR, -\b--\b-r\bru\bun\bn
- Attempt to start the array even if fewer drives
- were given than are needed for a full array. Nor-
- mally if not all drives are found and -\b--\b-s\bsc\bca\ban\bn is not
- used, then the array will be assembled but not
- started. With -\b--\b-r\bru\bun\bn an attempt will be made to
- start it anyway.
-
-
-G\bGe\ben\bne\ber\bra\bal\bl m\bma\ban\bna\bag\bge\bem\bme\ben\bnt\bt
- -\b-a\ba, -\b--\b-a\bad\bdd\bd
- hotadd listed devices.
-
-
- -\b-r\br, -\b--\b-r\bre\bem\bmo\bov\bve\be
- remove listed devices. The must not be active.
- i.e. they should be failed or spare devices.
-
-
- -\b-f\bf, -\b--\b-f\bfa\bai\bil\bl
- mark listed devices as faulty.
-
-
- -\b--\b-s\bse\bet\bt-\b-f\bfa\bau\bul\blt\bty\by
- same as --fail.
-
-
- -\b-R\bR, -\b--\b-r\bru\bun\bn
- start a partially built array.
-
-
- -\b-S\bS, -\b--\b-s\bst\bto\bop\bp
- deactivate array, releasing all resources.
-
-
- -\b-o\bo, -\b--\b-r\bre\bea\bad\bdo\bon\bnl\bly\by
- mark array as readonly.
-
-
- -\b-w\bw, -\b--\b-r\bre\bea\bad\bdw\bwr\bri\bit\bte\be
- mark array as readwrite.
-
-
-
-A\bAS\bSS\bSE\bEM\bMB\bBL\bLY\bY M\bMO\bOD\bDE\bE
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-a\bas\bss\bse\bem\bmb\bbl\ble\be _\bd_\be_\bv_\bi_\bc_\be _\bo_\bp_\bt_\bi_\bo_\bn_\bs_\b._\b._\b.
-
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-a\bas\bss\bse\bem\bmb\bbl\ble\be -\b--\b-s\bsc\bca\ban\bn _\bo_\bp_\bt_\bi_\bo_\bn_\bs_\b._\b._\b.
-
-
- This usage assembles one or more raid arrays from pre-
- existing components. For each array, mdadm needs to know
- the md device, the identity of the array, and a number of
- sub devices. These can be found in a number of ways.
-
- The md device is either given before -\b--\b-s\bsc\bca\ban\bn or is found
- from the config file. In the latter case, multiple md
- devices can be started with a single mdadm command.
-
- The identity can be given with the -\b--\b-u\buu\bui\bid\bd option, with the
- -\b--\b-s\bsu\bup\bpe\ber\br-\b-m\bmi\bin\bno\bor\br option, can be found in in the config file,
- or will be taken from the super block on the first subde-
- vice listed on the command line.
-
- Devices can be given on the -\b--\b-a\bas\bss\bse\bem\bmb\bbl\ble\be command line or
- from the config file. Only devices which have an md
- superblock which contains the right identity will be con-
- sidered for any device.
-
- The config file is only used if explicitly named with
- -\b--\b-c\bco\bon\bnf\bfi\big\bg or requested with -\b--\b-s\bsc\bca\ban\bn.\b. In the later case,
- /\b/e\bet\btc\bc/\b/m\bmd\bda\bad\bdm\bm.\b.c\bco\bon\bnf\bf is used.
-
- If -\b--\b-s\bsc\bca\ban\bn is not given, then the config file will only be
- used to find the identity of md arrays.
-
- Normally the array will be started after it is assembled.
- However is -\b--\b-s\bsc\bca\ban\bn is not given and insufficient drives
- were lists to start a complete (non-degraded) array, then
- the array is not started (to guard against usage errors).
- To insist that the array be started in this case (as may
- work for RAID1 or RAID5), give the -\b--\b-r\bru\bun\bn flag.
-
-
-
-B\bBU\bUI\bIL\bLD\bD M\bMO\bOD\bDE\bE
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-b\bbu\bui\bil\bld\bd _\bd_\be_\bv_\bi_\bc_\be -\b--\b-c\bch\bhu\bun\bnk\bk=\b=_\bX -\b--\b-l\ble\bev\bve\bel\bl=\b=_\bY -\b--\b-r\bra\bai\bid\bd-\b-
- d\bdi\bis\bsk\bks\bs=\b=_\bZ _\bd_\be_\bv_\bi_\bc_\be_\bs
-
-
- This usage is similar to -\b--\b-c\bcr\bre\bea\bat\bte\be. The difference is that
- it creates a legacy array without a superblock. With these
- arrays there is no difference between initially creating
- the array and subsequently assembling the array, except
- that hopefully there is useful data there in the second
- case.
-
- The level may only be 0, raid0, or linear. All devices
- must be listed and the array will be started once com-
- plete.
-
-
-C\bCR\bRE\bEA\bAT\bTE\bE M\bMO\bOD\bDE\bE
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-c\bcr\bre\bea\bat\bte\be _\bd_\be_\bv_\bi_\bc_\be -\b--\b-c\bch\bhu\bun\bnk\bk=\b=_\bX -\b--\b-l\ble\bev\bve\bel\bl=\b=_\bY
- -\b--\b-r\bra\bai\bid\bd-\b-d\bdi\bis\bsk\bks\bs=\b=_\bZ _\bd_\be_\bv_\bi_\bc_\be_\bs
-
-
- This usage will initialise a new md array, associate some
- devices with it, and activate the array.
-
- As devices are added, they are checked to see if they con-
- tain raid superblocks or filesystems. They are also check
- to see if the variance in device size exceeds 1%.
-
- If any discrepancy is found, the array will not automati-
- cally be run, though the presence of a -\b--\b-r\bru\bun\bn can override
- this caution.
-
-
- The General Management options that are valid with --cre-
- ate are:
-
- -\b--\b-r\bru\bun\bn insist of running the array even if some devices
- look like they might be in use.
-
-
- -\b--\b-r\bre\bea\bad\bdo\bon\bnl\bly\by
- start the array readonly - not supported yet.
-
-
-D\bDE\bET\bTA\bAI\bIL\bL M\bMO\bOD\bDE\bE
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-d\bde\bet\bta\bai\bil\bl [-\b--\b-b\bbr\bri\bie\bef\bf] _\bd_\be_\bv_\bi_\bc_\be _\b._\b._\b.
-
-
- This usage sill print out the details of the given array
- including a list of component devices. To determine names
- for the devices, m\bmd\bda\bad\bdm\bm searches /\b/d\bde\bev\bv for device files with
- the right major and minor numbers.
-
- With -\b--\b-b\bbr\bri\bie\bef\bf m\bmd\bda\bad\bdm\bm prints a single line that identifies
- the level, number of disks, and UUID of the array. This
- line is suitable for inclusion in /\b/e\bet\btc\bc/\b/m\bmd\bda\bad\bdm\bm.\b.c\bco\bon\bnf\bf.
-
-
-E\bEX\bXA\bAM\bMI\bIN\bNE\bE M\bMO\bOD\bDE\bE
- Usage: m\bmd\bda\bad\bdm\bm -\b--\b-e\bex\bxa\bam\bmi\bin\bne\be [-\b--\b-s\bsc\bca\ban\bn] [-\b--\b-b\bbr\bri\bie\bef\bf] _\bd_\be_\bv_\bi_\bc_\be _\b._\b._\b.
-
- This usage will examine some block devices to see if that
- have a valid RAID superblock on them. The information in
- each valid raid superblock will be printed.
-
- If -\b--\b-s\bsc\bca\ban\bn is used, the no devices should be listed, and
- the complete set of devices identified in the configura-
- tion file are checked. -\b--\b-s\bsc\bca\ban\bn implies -\b--\b-b\bbr\bri\bie\bef\bf but this
- implication can be countered by specifying -\b--\b-v\bve\ber\brb\bbo\bos\bse\be.
-
- With -\b--\b-b\bbr\bri\bie\bef\bf m\bmd\bda\bad\bdm\bm will output an config file entry of
- each distinct array that was found. This entry will list
- the UUID, the raid level, and a list of the individual
- devices on which a superblock for that array was found.
- This output will by syntactically suitable for inclusion
- in the configuration file, but should N\bNO\bOT\bT be used blindly.
- Often the array description that you want in the configu-
- ration file is much less specific than that given by m\bmd\bda\bad\bdm\bm
- -\b-B\bBs\bs. For example, you normally do not want to list the
- devices, particularly if they are SCSI devices.
-
-
-
-F\bFI\bIL\bLE\bES\bS
- /\b/p\bpr\bro\boc\bc/\b/m\bmd\bds\bst\bta\bat\bt
- If you're using the /\b/p\bpr\bro\boc\bc filesystem, /\b/p\bpr\bro\boc\bc/\b/m\bmd\bds\bst\bta\bat\bt gives
- you informations about md devices status. This file is
- not currently used by m\bmd\bda\bad\bdm\bm.
-
-
- /\b/e\bet\btc\bc/\b/m\bmd\bda\bad\bdm\bm.\b.c\bco\bon\bnf\bf
- The config file is line oriented with, as usual, blank
- lines and lines beginning with a hash (or pound sign or
- sharp or number sign, whichever you like to call it)
- ignored. Lines that start with a blank are treated as
- continuations of the previous line (I don't like trailing
- slashes).
-
- Each line contains a sequence of space-separated words,
- the first of which identified the type of line. Keywords
- are case-insensitive, and the first work on a line can be
- abbreviated to 3 letters.
-
- There are two types of lines. ARRAY and DEVICE.
-
- The DEVICE lines usually come first. All remaining words
- on the line are treated as names of devices, possibly con-
- taining wild cards (see _\bg_\bl_\bo_\bb(7)). These list all the
- devices that m\bmd\bda\bad\bdm\bm is allowed to scan when looking for
- devices with RAID superblocks. Each line can contain mul-
- tiple device names, and there can be multiple DEVICE
- lines. For example:
-
- DEVICE /dev/hda* /dev/hdc*
- DEV /dev/sd*
- DEVICE /dev/discs/disc*/disc
-
- The ARRAY lines identify actual arrays. The second word
- on the line should be the name of the device where the
- array is normally assembled, such as /dev/md1. Subsequent
- words identify the array. If multiple identities are
- given, then the array much match ALL identities to be con-
- sidered a match. Each identity word has a tag, and equals
- sign, and some value. The options are:
-
-
- u\buu\bui\bid\bd=\b= The value should be a 128 bit uuid in hexadecimal,
- with punctuation interspersed if desired. This
- must match the uuid stored in the superblock.
-
- s\bsu\bup\bpe\ber\br-\b-m\bmi\bin\bno\bor\br=\b=
- The value is an integer which indicates the minor
- number that was stored in the superblock when the
- array was created. When an array is created as
- /dev/mdX, then the minor number X is stored.
-
- d\bde\bev\bvi\bic\bce\bes\bs=\b=
- The value is a comma separated list of device
- names. Precisely these devices will be used to
- assemble the array. Note that the devices listed
- there must also be listed on a DEVICE line.
-
- l\ble\bev\bve\bel\bl=\b= The value is a raid level. This is normally used
- to identify an array, but is supported so that the
- output of m\bmd\bda\bad\bdm\bm -\b--\b-e\bex\bxa\bam\bmi\bin\bne\be -\b--\b-s\bsc\bca\ban\bn can be use
- directly in the configuration file.
-
- d\bdi\bis\bsk\bks\bs=\b= The value is the number of disks in a complete
- active array. As with l\ble\bev\bve\bel\bl=\b= this is mainly for
- compatibility with the output of m\bmd\bda\bad\bdm\bm -\b--\b-e\bex\bxa\bam\bmi\bin\bne\be
- -\b--\b-s\bsc\bca\ban\bn.
-
-
-T\bTO\bOD\bDO\bO
- Finish and document Follow mode.
-
-
-S\bSE\bEE\bE A\bAL\bLS\bSO\bO
- For information on the various levels of RAID, check out:
-
-
- http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
-
- for new releases of the RAID driver check out:
-
-
- ftp://ftp.kernel.org/pub/linux/kernel/peo-
- ple/mingo/raid-patches
-
- or
-
- http://www.cse.unsw.edu.au/~neilb/patches/linux-
- stable/
-
- _\br_\ba_\bi_\bd_\bt_\ba_\bb(5), _\br_\ba_\bi_\bd_\b0_\br_\bu_\bn(8), _\br_\ba_\bi_\bd_\bs_\bt_\bo_\bp(8), _\bm_\bk_\br_\ba_\bi_\bd(8)
-
-
-
- mdadm(8)
--- /dev/null
+Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
+Name: mdadm
+Version: 0.7.1
+Release: 1
+Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
+URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/
+Copyright: GPL
+Group: Utilities/System
+BuildRoot: /var/tmp/%{name}-root
+Packager: Danilo Godec <danci@agenda.si>
+
+%description
+mdadm is a single program that can be used to control Linux md devices. It
+is intended to provide all the functionality of the mdtools and raidtools
+but with a very different interface.
+
+mdadm can perform all functions without a configuration file. There is the
+option of using a configuration file, but not in the same way that raidtools
+uses one.
+
+raidtools uses a configuration file to describe how to create a RAID array,
+and also uses this file partially to start a previously created RAID array.
+Further, raidtools requires the configuration file for such things as
+stopping a raid array, which needs to know nothing about the array.
+
+
+%prep
+%setup -q
+
+%build
+# This is a debatable issue. The author of this RPM spec file feels that
+# people who install RPMs (especially given that the default RPM options
+# will strip the binary) are not going to be running gdb against the
+# program.
+make CFLAGS="$RPM_OPT_FLAGS"
+
+%install
+#rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/sbin
+install -m755 mdadm $RPM_BUILD_ROOT/sbin/
+mkdir -p $RPM_BUILD_ROOT/etc
+install -m644 mdadm.conf-example $RPM_BUILD_ROOT/etc/mdadm.conf
+mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man4
+mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man5
+mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
+install -m644 md.4 $RPM_BUILD_ROOT/%{_mandir}/man4/
+install -m644 mdadm.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/
+install -m644 mdadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc TODO ChangeLog mdadm.man mdadm.conf-example
+/sbin/mdadm
+/etc/mdadm.conf
+%{_mandir}/man*/md*
+
+%changelog
+* Wed Mar 12 2002 NeilBrown <neilb@cse.unsw.edu.au>
+- Add md.4 and mdadm.conf.5 man pages
+* Fri Mar 08 2002 Chris Siebenmann <cks@cquest.utoronto.ca>
+- builds properly as non-root.
+* Fri Mar 08 2002 Derek Vadala <derek@cynicism.com>
+- updated for 0.7, fixed /usr/share/doc and added manpage
+* Tue Aug 07 2001 Danilo Godec <danci@agenda.si>
+- initial RPM build
+++ /dev/null
-Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
-Name: mdadm
-Version: 0.5
-Release: 1
-Source0: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
-URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/
-Copyright: GPL
-Group: Utilities/System
-BuildRoot: /var/tmp/%{name}-root
-Packager: Danilo Godec <danci@agenda.si>
-
-%description
-mdadm is a single program that can be used to control Linux md devices. It
-is intended to provide all the functionality of the mdtools and raidtools
-but with a very different interface.
-
-mdadm can perform all functions without a configuration file. There is the
-option of using a configuration file, but not in the same way that raidtools
-uses one.
-
-raidtools uses a configuration file to describe how to create a RAID array,
-and also uses this file partially to start a previously created RAID array.
-Further, raidtools requires the configuration file for such things as
-stopping a raid array, which needs to know nothing about the array.
-
-
-%prep
-%setup -q -n mdadm
-
-%build
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/sbin
-install -m755 mdadm $RPM_BUILD_ROOT/sbin/
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%doc TODO testconfig testconfig2
-/sbin/*
-
-%changelog
-* Tue Aug 07 2001 Danilo Godec <danci@agenda.si>
-- initial RPM build
int calc_sb_csum(mdp_super_t *super)
{
unsigned int oldcsum = super->sb_csum;
- unsigned long long newcsum = 0; /* FIXME why does this make it work?? */
+ unsigned long long newcsum = 0;
unsigned long csum;
int i;
unsigned int *superc = (int*) super;
return csum;
}
-char *human_size(long kbytes)
+char *human_size(long long bytes)
{
static char buf[30];
+
- if (kbytes < 2000)
+ if (bytes < 5000*1024)
buf[0]=0;
- else if (kbytes < 2*1024*1024)
- sprintf(buf, " (%d MiB)", kbytes>>10);
+ else if (bytes < 2*1024LL*1024LL*1024LL)
+ sprintf(buf, " (%d.%02d MiB %d.%02d MB)",
+ (long)(bytes>>20),
+ (long)(bytes&0xfffff)/(0x100000/100),
+ (long)(bytes/1000/1000),
+ (long)((bytes%1000000)/10000)
+ );
else
- sprintf(buf, " (%d GiB)", kbytes>>20);
+ sprintf(buf, " (%d.%02d GiB %d.%02d GB)",
+ (long)(bytes>>30),
+ (long)((bytes>>10)&0xfffff)/(0x100000/100),
+ (long)(bytes/1000LL/1000LL/1000LL),
+ (long)(((bytes/1000)%1000000)/10000)
+ );
return buf;
}