11 years agoImprove reporting of layout for raid10.
NeilBrown [Mon, 13 Oct 2008 05:15:18 +0000 (16:15 +1100)] 
Improve reporting of layout for raid10.

Showing e.g.

   near=1, far=2

for the 'far2' layout of raid10 is confusing even though there is a
sense in which is it correct.

Make it less confusing by only printing whichever number is not 1.
If both are 1, make that clear too (i.e. no redundancy).

11 years agoManage: allow adding device that is just large enough to v1.x array.
NeilBrown [Mon, 13 Oct 2008 05:15:16 +0000 (16:15 +1100)] 
Manage: allow adding device that is just large enough to v1.x array.

When adding a device to an array, we check that it is large enough.

Currently the check makes sure there is also room for a reasonably
sized bitmap.  But if the array doesn't have a bitmap, then this test
might be too restrictive.
So when adding, only insist there is enough space for the current
When Creating, still require room for the standard sized bitmap.

This resolved Debian Bug 500309

12 years agoCosmetic cleanup of some messages.
NeilBrown [Fri, 1 Aug 2008 06:48:08 +0000 (16:48 +1000)] 
Cosmetic cleanup of some messages.

e.g. --raid-disks is preferred over --raid-devices.

 Thanks to "Jon Nelson" <>

Signed-off-by: NeilBrown <>
12 years agoClean up usage of open()
Doug Ledford [Thu, 24 Jul 2008 22:35:11 +0000 (18:35 -0400)] 
Clean up usage of open()
Fix on call that passed an invalid mode to open
Don't pass a third arg unless we also pass O_CREAT
Use symbolic args for 2nd and 3rd args

Signed-off-by: Doug Ledford <>
12 years agoAdd support for distribution specific build extensions
Doug Ledford [Thu, 24 Jul 2008 16:34:34 +0000 (12:34 -0400)] 
Add support for distribution specific build extensions

Signed-off-by: Doug Ledford <>
12 years agoFix confusing usage in md.4 man page.
Neil Brown [Tue, 8 Jul 2008 00:03:09 +0000 (10:03 +1000)] 
Fix confusing usage in md.4 man page.

"degraded write performance" could be confused with "write performance
when degraded".  It really means "reduced write performance", so say

12 years agoDescribe the HOMEHOST entry in the mdadm.conf man page.
Neil Brown [Mon, 7 Jul 2008 01:30:26 +0000 (11:30 +1000)] 
Describe the HOMEHOST entry in the mdadm.conf man page.

12 years agoSome more cleanup of tests.
Neil Brown [Fri, 27 Jun 2008 06:11:40 +0000 (16:11 +1000)] 
Some more cleanup of tests.

Don't use '$mdadm', just 'mdadm'.
And --stop all arrays when finished.

12 years agoAdd test for stoping and restarting a raid5 reshape.
Neil Brown [Fri, 27 Jun 2008 06:07:52 +0000 (16:07 +1000)] 
Add test for stoping and restarting a raid5 reshape.

There was a kernel bug with stopping and restarting
raid5 recently.  So add a test to check for it.

12 years agoAdd "bitmap=" to "--detail --brief" output when relevant.
Neil Brown [Wed, 25 Jun 2008 23:33:37 +0000 (09:33 +1000)] 
Add "bitmap=" to "--detail --brief" output when relevant.

Thanks to "Jon Nelson" <> for the suggestion.

Signed-off-by: Neil Brown <>
12 years agoImprove error message when mdadm fails to stop an array.
Neil Brown [Wed, 25 Jun 2008 23:27:15 +0000 (09:27 +1000)] 
Improve error message when mdadm fails to stop an array.

Signed-off-by: Neil Brown <>
12 years agoCouple more man page fixes
Neil Brown [Wed, 25 Jun 2008 23:25:08 +0000 (09:25 +1000)] 
Couple more man page fixes

Signed-off-by: Neil Brown <>
12 years agoAdd text to man pages suggesting partition type to use for version 1.x metadata.
Pascal Charest [Wed, 25 Jun 2008 23:21:40 +0000 (09:21 +1000)] 
Add text to man pages suggesting partition type to use for version 1.x metadata.

Signed-off-by: Neil Brown <>
12 years agoItalic/bold fixes in man pages.
Neil Brown [Wed, 25 Jun 2008 23:11:59 +0000 (09:11 +1000)] 
Italic/bold fixes in man pages.

Two places that should have been .B or .I were .M, which of
course is an error.
So fix these and that the opportunity to be more consistent
with highlighting of "mdadm".  Make it always italic except when
used as a literal example, then bold.

12 years agoFix bug in forced assemble.
Chris Webb [Thu, 19 Jun 2008 06:30:39 +0000 (16:30 +1000)] 
Fix bug in forced assemble.

From: Chris Webb <>

We are loading into the already-loaded 'st' instead of the
newly create 'tst', which is clearly wrong.

12 years agoFix an error when assembling arrays that are in the middle of a reshape.
Neil Brown [Thu, 19 Jun 2008 06:30:36 +0000 (16:30 +1000)] 
Fix an error when assembling arrays that are in the middle of a reshape.

It is important that dup_super always returns an 'st' with the same
->ss and ->minor_version as the st that was passed.
This wasn't happening for 0.91 metadata (i.e. in the middle of a reshape).

12 years agoRelease 2.6.7 mdadm-2.6.7
Neil Brown [Fri, 6 Jun 2008 06:07:11 +0000 (16:07 +1000)] 
Release 2.6.7

12 years agoAvoid NULL reference calling free_super and elsewhere.
Neil Brown [Tue, 27 May 2008 07:23:16 +0000 (17:23 +1000)] 
Avoid NULL reference calling free_super and elsewhere.

Since we made free_super a superswitch call, we need to be careful
that st is non NULL before calling st->ss->free_super(st).
Also when updating byteorder there is a chance of a similar NULL

12 years agoRemove stray semicolon
Neil Brown [Tue, 27 May 2008 07:23:09 +0000 (17:23 +1000)] 
Remove stray semicolon

Causes compile error with gcc-2.95

12 years agoFix autoassemble for stack arrays.
Neil Brown [Tue, 20 May 2008 06:28:48 +0000 (16:28 +1000)] 
Fix autoassemble for stack arrays.

If you have stacked arrays, then
  mdadm -As --homehost=fred
should work but doesn't.  It gets into an infinite loop!

So write some tests, and fix the bugs.

12 years agoRelease 2.6.6 mdadm-2.6.6
Neil Brown [Mon, 19 May 2008 02:07:54 +0000 (12:07 +1000)] 
Release 2.6.6

12 years agoRemove outdated HOWTO link and credit Jakob's contribution.
David Greaves [Mon, 19 May 2008 02:07:50 +0000 (12:07 +1000)] 
Remove outdated HOWTO link and credit Jakob's contribution.

From: David Greaves <>

Signed-off-by: David Greaves <>
12 years agoInclude sysfs.c in
Neil Brown [Mon, 19 May 2008 02:07:47 +0000 (12:07 +1000)] 
Include sysfs.c in

and tidy up Makefile a bit.

12 years ago"make everything" now also makes
Neil Brown [Mon, 19 May 2008 02:07:43 +0000 (12:07 +1000)] 
"make everything" now also makes

This is
  make MDASSEMBLE_AUTO=1 mdassemble.static

so we now find compile bugs more easily.

12 years agoRelease 2.6.5 mdadm-2.6.5
Neil Brown [Thu, 15 May 2008 05:50:59 +0000 (15:50 +1000)] 
Release 2.6.5

12 years agoGet Changelog uptodate
Neil Brown [Thu, 15 May 2008 05:50:57 +0000 (15:50 +1000)] 
Get Changelog uptodate

12 years agoCompiple fixes for mdassemble and diet-libc
Neil Brown [Thu, 15 May 2008 05:50:56 +0000 (15:50 +1000)] 
Compiple fixes for mdassemble and diet-libc

12 years agoDon't try the auto-detect test when md_mod is a module
Neil Brown [Thu, 15 May 2008 05:50:50 +0000 (15:50 +1000)] 
Don't try the auto-detect test when md_mod is a module this cannot work.

12 years agoFix support for --update=swapsuper
Neil Brown [Thu, 15 May 2008 05:50:48 +0000 (15:50 +1000)] 
Fix support for --update=swapsuper

The user of dup_super broke it.

12 years agoRecent change broken handling of metadata-less arrays.
Neil Brown [Thu, 15 May 2008 05:50:47 +0000 (15:50 +1000)] 
Recent change broken handling of metadata-less arrays.

In particular, failing a device would give a silly
error message.

12 years agoFix possible NULL dereference in super_by_fd
Neil Brown [Thu, 15 May 2008 05:50:45 +0000 (15:50 +1000)] 
Fix possible NULL dereference in super_by_fd

12 years agoAvoid possible null dereference in Assemble.
Neil Brown [Thu, 15 May 2008 05:50:42 +0000 (15:50 +1000)] 
Avoid possible null dereference in Assemble.

If the first device we look at has no superblock,
there is no 'st' to free, so don't free it.

12 years agoSet LOG_PID for syslog
Hans Lambermont [Mon, 12 May 2008 02:21:56 +0000 (12:21 +1000)] 
Set LOG_PID for syslog

From: Hans Lambermont <>

12 years agoadd --export option to --examine
Kay Sievers [Tue, 6 May 2008 00:02:38 +0000 (10:02 +1000)] 
add --export option to --examine

From: Kay Sievers <>

Cc: David Zeuthen <>
Signed-off-by: Kay Sievers <>
12 years agoMake device-special files for partitions when using --incremental
Neil Brown [Mon, 5 May 2008 11:55:39 +0000 (21:55 +1000)] 
Make device-special files for partitions when using --incremental

12 years agolet '-a' be specified for Incremental mode
Dan Williams [Mon, 5 May 2008 11:55:37 +0000 (21:55 +1000)] 
let '-a' be specified for Incremental mode

From: Dan Williams <>

Signed-off-by: Dan Williams <>
12 years agoUnify code into find_free_devnum.
Neil Brown [Mon, 5 May 2008 11:55:36 +0000 (21:55 +1000)] 
Unify code into find_free_devnum.

Two places have code to find a free md device number.  Make this
a subroutine.

12 years agofix load_super/free_super mismatch in util.c
Dan Williams [Mon, 5 May 2008 11:55:35 +0000 (21:55 +1000)] 
fix load_super/free_super mismatch in util.c

From: Dan Williams <>

Signed-off-by: Dan Williams <>
12 years agoSimplistig locking for --incremental.
Bill Nottingham [Mon, 5 May 2008 09:44:04 +0000 (19:44 +1000)] 
Simplistig locking for --incremental.

From: Bill Nottingham <>

mdadm --incremental doesn't really do any locking. If you get multiple
events in parallel for the same device (that has not yet started), they
will all go down the path to create the array. One will succeed, the
rest will have SET_ARRAY_INFO die with -EBUSY (md: array mdX already has disks!)
and will exit without adding the disk.

Original bug report is:

This is solved by adding very very rudimentary locking. Incremental() now
opens the device with O_EXCL to ensure only one invocation is frobbing the
array at once. A simple loop just tries to open 5 times a second for 5
seconds. If the array stays locked that long, you probably have bigger

12 years agoCreate /dev/md if needed and it doesn't exist.
Bill Nottingham [Mon, 5 May 2008 09:44:01 +0000 (19:44 +1000)] 
Create /dev/md if needed and it doesn't exist.

From: Bill Nottingham <>

12 years agoFix RAID acronym in man page.
Neil Brown [Mon, 5 May 2008 09:43:58 +0000 (19:43 +1000)] 
Fix RAID acronym in man page.

The 'D' in 'RAID' stands for 'DISKS' even it md supports other 'devices'.

12 years agoAdd a .gitignore file.
Neil Brown [Tue, 29 Apr 2008 07:14:01 +0000 (17:14 +1000)] 
Add a .gitignore file.

12 years agoUse .\" instead of '''
Neil Brown [Tue, 29 Apr 2008 07:13:59 +0000 (17:13 +1000)] 
Use .\" instead of '''

Debian bug 477273

12 years agodiff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c
Neil Brown [Tue, 29 Apr 2008 07:13:55 +0000 (17:13 +1000)] 
diff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c

12 years agoFix possible bug with bitmap space allocation with v1.0 metadata
Neil Brown [Tue, 29 Apr 2008 07:13:53 +0000 (17:13 +1000)] 
Fix possible bug with bitmap space allocation with v1.0 metadata

When adding a device to an array, make sure we don't reserve
so much space for the bitmap that there isn't room for the data.

12 years agoSmall improvements to --incremental for arrays that are in the middle of reshape
Neil Brown [Mon, 28 Apr 2008 06:30:31 +0000 (16:30 +1000)] 
Small improvements to --incremental for arrays that are in the middle of reshape

There is still a problem:  If array is partially assembled and started
read-only, the last device doesn't get added properly.  Probably a kernel

12 years agoAllow creation of a RAID6 with a single missing device.
Neil Brown [Mon, 28 Apr 2008 06:30:09 +0000 (16:30 +1000)] 
Allow creation of a RAID6 with a single missing device.

This did not work before as we couldn't mark it clean as there would
be some parity blocks out of sync, and raid6 will not assemble a
dirty degraded array.
So make such arrays doubly degraded (the last device becomes a spare)
and clean.

12 years agoUpdates some URLs in the man page.
Neil Brown [Mon, 28 Apr 2008 06:29:53 +0000 (16:29 +1000)] 
Updates some URLs in the man page.

Particularly, add the wiki on

12 years agoPrint 'Events' more sensibly.
Neil Brown [Mon, 28 Apr 2008 06:29:45 +0000 (16:29 +1000)] 
Print 'Events' more sensibly.

Instead of MSW.LSW, just print it as a 64bit number.

12 years agoFix problems with array.size overflowing on large arrays.
Neil Brown [Mon, 28 Apr 2008 06:29:37 +0000 (16:29 +1000)] 
Fix problems with array.size overflowing on large arrays.

array.size is 32bits and counts K.  So for arrays with
more than 4Terrabytes, it can overflow.
The correct number can be read from sysfs, but there are still
a few places that use array.size and risk truncation.  What is worse.
they compare a number of kilobytes with a number of sectors !!

So use get_component_size() to read the sysfs information, and be
more consistent about units.

12 years agoFix for segfault when reading /proc/mdstat
Neil Brown [Mon, 28 Apr 2008 06:29:12 +0000 (16:29 +1000)] 
Fix for segfault when reading /proc/mdstat

Some kernel versions don't put a space between 'active' and '(auto-read-only)'
in /proc/mdstat.  This causes a parsing problem leaving 'level' set to
NULL which causes a crash.

So synthesise a space there if it is missing, and check for 'level' to
be NULL and don't de-ref if it is.

12 years agoUse sysfs info for metadata version info in Detail and elsewhere.
Neil Brown [Fri, 14 Dec 2007 09:15:21 +0000 (20:15 +1100)] 
Use sysfs info for metadata version info in Detail and elsewhere.

12 years agoReplace sysarray with mdinfo
Neil Brown [Fri, 14 Dec 2007 09:14:59 +0000 (20:14 +1100)] 
Replace sysarray with mdinfo

Sure, mdinfo is bigger, but having a uniform structure for lots of things
will make life easier.

12 years agoUse 'mdinfo' instead of special 'sysdev' structure.
Neil Brown [Fri, 14 Dec 2007 09:14:57 +0000 (20:14 +1100)] 
Use 'mdinfo' instead of special 'sysdev' structure.

there is needless duplicatiion between mdinfo and sysdev, so discard
the latter.

12 years agoSome tidy up of 'devices' in assemble.
Neil Brown [Fri, 14 Dec 2007 09:14:53 +0000 (20:14 +1100)] 
Some tidy up of 'devices' in assemble.

use "mdinfo" in the devices list rather than just copying
ad-hoc fields in.

12 years agoDon't record oldmajor/oldminor any more during assemble.
Neil Brown [Fri, 14 Dec 2007 09:14:44 +0000 (20:14 +1100)] 
Don't record oldmajor/oldminor any more during assemble.

We don't use the information at all (any longer).

12 years agoFind super from fd on an array.
Neil Brown [Fri, 14 Dec 2007 09:14:38 +0000 (20:14 +1100)] 
Find super from fd on an array.

We used to use the major/minor numbers, but that isn't sufficient
any more, so pass the fd, and possibly check 'text' version.

12 years agoDrop the superblock arg from all metadata methods.
Neil Brown [Fri, 14 Dec 2007 09:14:33 +0000 (20:14 +1100)] 
Drop the superblock arg from all metadata methods.

It is now in the 'supertype'

12 years agoFix compare_super to take supertype instead of a superblock.
Neil Brown [Fri, 14 Dec 2007 09:14:27 +0000 (20:14 +1100)] 
Fix compare_super to take supertype instead of a superblock.

As this function takes 2 superblocks, the change is a bit more subtle,
so is done separately.

12 years agoAdd 'supertype' arg to almost all metadata methods.
Neil Brown [Fri, 14 Dec 2007 09:14:16 +0000 (20:14 +1100)] 
Add 'supertype' arg to almost all metadata methods.

The 'superblock' will be moved into this structure soon.

12 years agoAllow metadata handlers to free their own superblock.
Neil Brown [Fri, 14 Dec 2007 09:14:00 +0000 (20:14 +1100)] 
Allow metadata handlers to free their own superblock.

As the metadata handler allocates the superblock, it should free it
too.  DDF will have a more complex 'superblock' which needs more complex

12 years agoMake sure sysfs_read never succeeds for a non-MD device.
Neil Brown [Fri, 14 Dec 2007 09:13:51 +0000 (20:13 +1100)] 
Make sure sysfs_read never succeeds for a non-MD device.

... just in case.

12 years agoRemove spaces/tabs from ends of lines.
Neil Brown [Fri, 14 Dec 2007 09:13:43 +0000 (20:13 +1100)] 
Remove spaces/tabs from ends of lines.

12 years agoA recent patch broke --create --level=faulty - fix it.
Neil Brown [Thu, 29 Nov 2007 03:40:01 +0000 (14:40 +1100)] 
A recent patch broke --create --level=faulty - fix it.

Thanks to Martin Bene.

12 years agoAdd metadata version information to "--detail --brief" output.
Neil Brown [Mon, 12 Nov 2007 22:55:29 +0000 (09:55 +1100)] 
Add metadata version information to "--detail --brief" output.

12 years agoRelease 2.6.4 mdadm-2.6.4
Neil Brown [Fri, 19 Oct 2007 04:13:04 +0000 (14:13 +1000)] 
Release 2.6.4

12 years agoRemove partitions from a device before adding it to an array.
Neil Brown [Fri, 19 Oct 2007 04:03:17 +0000 (14:03 +1000)] 
Remove partitions from a device before adding it to an array.

The 'remove_partitions' call is in the wrong place and applying
to the wrong file.

12 years agoAdd some extra consistency checks based on level.
Neil Brown [Wed, 17 Oct 2007 03:08:12 +0000 (13:08 +1000)] 
Add some extra consistency checks based on level.

Also use LEVEL_LINEAR, LEVEL_MULTIPATH in place of -1 or -4 in a few places.

12 years agoClarify the avail/used devices sizes with version1 superblock.
Neil Brown [Wed, 17 Oct 2007 00:28:38 +0000 (10:28 +1000)] 
Clarify the avail/used devices sizes with version1 superblock.

Not all of the device may be available.  Of that, not all may be used
(if devices are of different sizes).

12 years agoMake sure --auto=mdp is honoured properly
Neil Brown [Wed, 17 Oct 2007 00:00:55 +0000 (10:00 +1000)] 
Make sure --auto=mdp is honoured properly

This would only create partitioned devices if the device name was a
'standard' name.  This this patch, any name will work.

12 years agoFix restarting of a reshaping array.
Neil Brown [Tue, 16 Oct 2007 03:52:35 +0000 (13:52 +1000)] 
Fix restarting of a reshaping array.

The last release broke the ability to assemble an array that
was in the middle of a reshape.
This patch adds code to test if the critical section needs
to be restored or not so that - if we have failed to restore it,
we know whether to fail or not.

13 years agoAlso use &tst instead of st later on when loading v1 superblocks
Jérémy Bobbio [Mon, 1 Oct 2007 08:17:06 +0000 (09:17 +0100)] 
Also use &tst instead of st later on when loading v1 superblocks

13 years agoFix segfault on assembly on amd64 with v1 superblocks
martin f. krafft [Sun, 30 Sep 2007 12:22:56 +0000 (13:22 +0100)] 
Fix segfault on assembly on amd64 with v1 superblocks

Commit a40b4fe introduced a temporary supertype variable tst, instead of
manipulating st directly. However, it was forgotton to pass &tst into the
recursive load_super1 call, causing an infinite recursion.

Signed-off-by: martin f. krafft <>
13 years agoMonitor.c s/MAXINT/INT_MAX/g
maximilian attems [Wed, 26 Sep 2007 16:12:46 +0000 (18:12 +0200)] 
Monitor.c s/MAXINT/INT_MAX/g

include limits.h directly instead of values.h

Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agomdopen.c don't shadow major() and minor()
maximilian attems [Wed, 26 Sep 2007 16:12:47 +0000 (18:12 +0200)] 
mdopen.c don't shadow major() and minor()


Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agoMonitor.c include signal.h directly
maximilian attems [Wed, 26 Sep 2007 16:12:45 +0000 (18:12 +0200)] 
Monitor.c include signal.h directly

another small step for better klibc support, glibc compile tested.

Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agoAdd ANNOUNCE-2.6.1 to git
Neil Brown [Mon, 24 Sep 2007 04:40:23 +0000 (14:40 +1000)] 
Add ANNOUNCE-2.6.1 to git

Somehow this missed out of getting into .git even though it is in all
tha tar-balls.

13 years agoDon't corrupt 'supertype' when speculatively calling load_super1
Neil Brown [Mon, 24 Sep 2007 04:26:44 +0000 (14:26 +1000)] 
Don't corrupt 'supertype' when speculatively calling load_super1

When load_super1 is trying to see which sub-version of v1 superblock
is present, failure will cause it to clear st->ss, which is not good.

So use a temporary 'super_type' for the 'test if this version works'
calls, then copy that into 'st' on success.

13 years agoconfig.c include dirent.h instead sys/dir.h
maximilian attems [Fri, 21 Sep 2007 17:32:18 +0000 (19:32 +0200)] 
config.c include dirent.h instead sys/dir.h

sys/dir.h is an old BSD'ism, include dirent directly.
small step for better klibc support.

compile tested against glibc.

Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agoCreate.c s/major/major_num/
maximilian attems [Fri, 21 Sep 2007 17:32:19 +0000 (19:32 +0200)] 
Create.c s/major/major_num/

don't shadow the major() function by int major.

Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agoAdd klibc support to mdadm.h
maximilian attems [Fri, 21 Sep 2007 17:32:17 +0000 (19:32 +0200)] 
Add klibc support to mdadm.h

klibc still misses a lot functionality to let mdadm link against,
this small step helps to get to the real trouble.. :)

Signed-off-by: maximilian attems <>
Signed-off-by: Neil Brown <>
13 years agoMake "--write-mostly" effective when re-adding a device to an array.
Neil Brown [Mon, 24 Sep 2007 03:14:13 +0000 (13:14 +1000)] 
Make "--write-mostly" effective when re-adding a device to an array.

Fixes Debian Bug 442874

When we discover that we can 're-add' a drive, we forget to check the
write-mostly flag.
This highlights the fact that you cannot turn 'off' the write-mostly
flag at this point.  I wonder if that is a problem...

13 years agoExplain the read-balancing algorithm for RAID1 better in md.4
Iustin Pop [Tue, 11 Sep 2007 14:20:19 +0000 (16:20 +0200)] 
Explain the read-balancing algorithm for RAID1 better in md.4

From: Iustin Pop <>

There are many questions on the mailing list about the RAID1 read
performance profile. This patch adds a new paragraph to the RAID1
section in md.4 that details what kind of speed-up one should expect
from RAID1.

Signed-off-by: Iustin Pop <>
13 years agoRelease 2.6.3 mdadm-2.6.3
Neil Brown [Mon, 20 Aug 2007 04:22:15 +0000 (14:22 +1000)] 
Release 2.6.3

13 years agoUpdate changelog
Neil Brown [Mon, 20 Aug 2007 04:14:46 +0000 (14:14 +1000)] 
Update changelog

13 years agoReport error when grow cannot be restarted.
Neil Brown [Mon, 20 Aug 2007 04:14:42 +0000 (14:14 +1000)] 
Report error when grow cannot be restarted.

Make sure that if --assemble find an array in the critical region
of a reshape, and cannot find the critical data to restart the
reshape, it gives an error message.

13 years agoFix error message when adding a device that is too small.
Neil Brown [Mon, 20 Aug 2007 04:14:28 +0000 (14:14 +1000)] 
Fix error message when adding a device that is too small.

We were multiplying MD_RESERVED_SECTORS by 1024 instead of 512,
so lots of 'is it too small' checks were wrong.

13 years agoFix problem with add a device to a 1.x array created with older mdadm.
Neil Brown [Mon, 20 Aug 2007 04:14:25 +0000 (14:14 +1000)] 
Fix problem with add a device to a 1.x array created with older mdadm.

When adding new disk to an array, don't reserve so much bitmap
space that the disk cannot store the required data. (Needed when
1.x array was created with older mdadm).

13 years agoReject '--bitmap none' for build and create.
Neil Brown [Mon, 23 Jul 2007 07:28:44 +0000 (17:28 +1000)] 
Reject '--bitmap none' for build and create.

We don't want to create a file called 'none', and it isn't needed,
so just reject it.

13 years ago"--export" segfaults with non-persistent super blocks
Tim Woods [Mon, 23 Jul 2007 07:15:52 +0000 (17:15 +1000)] 
"--export" segfaults with non-persistent super blocks

From: Tim Woods <>

This patch fixes a NULL pointer dereference in Detail.c when running
'mdadm --detail --export' on a device with non-persistent super blocks.

13 years agoIn the MISC MODE section in mdadm(8), the names of the options should be
Neil Brown [Sun, 22 Jul 2007 23:32:01 +0000 (09:32 +1000)] 
In the MISC MODE section in mdadm(8), the names of the options should be
in bold.

  -- AYM 2007-01-14

diff -ur mdadm-2.6/mdadm.8 mdadm-2.6-man1/mdadm.8

13 years agoSubstantial corrections to man pages.
Scott Weikart [Fri, 13 Jul 2007 05:13:43 +0000 (15:13 +1000)] 
Substantial corrections to man pages.

From: "Scott Weikart" <>

Thanks Scott!

13 years agoTypo in man page: Multipath has an L ...
Neil Brown [Tue, 10 Jul 2007 23:08:49 +0000 (09:08 +1000)] 
Typo in man page: Multipath has an L ...

13 years agoAllow "--write-behind=" to be done in grow mode.
Ian Dall [Mon, 9 Jul 2007 01:29:04 +0000 (11:29 +1000)] 
Allow "--write-behind=" to be done in grow mode.

From: Ian Dall <>

I have a small patch to mdadm which allows the write-behind amount to be
set a array grow time (instead of currently only at grow or create
time). I have tested this fairly extensively on some arrays built out of
loop back devices, and once on a real live array.

13 years agoEnhance raid4 support: --assemble and --monitor wasn't quite happy with it.
Doug Ledford [Mon, 9 Jul 2007 00:00:02 +0000 (10:00 +1000)] 
Enhance raid4 support: --assemble and --monitor wasn't quite happy with it.

From: Doug Ledford <>

This one actually does a couple things.  Mainly related to raid4, but
kinda touches other raid levels some.

When creating a raid4 array, treat it like a raid5 array in that we
create it in degraded mode by default and add the last disk as a spare.
Besides speeding things up, this has a second effect that it makes mdadm
more consistent.  In order to create a degraded raid5 array, you need
only passing missing as one of the devices.  For a degraded raid4 array,
prior to this patch, you must pass assume-clean or else it refuses to
create the array.  Even force won't make it work without assume-clean.
With the patch, raid4 behaves identical to raid5.

Separate from that, the monitor functionality completely ignores raid4
arrays.  That seems to stem from the code that checks to see if the
array is part of a long list of types.  It seems easier to check which
array types *aren't* redundant instead of listing the ones that are
redundant and missing some of them.  This makes the monitor service
actually watch raid4 arrays.

13 years agoFix parsing of "-a" in various contexts.
Doug Ledford [Sun, 8 Jul 2007 23:59:59 +0000 (09:59 +1000)] 
Fix parsing of "-a" in various contexts.

From: Doug Ledford <>

This one fixes a bug where once manage mode is set, the -a short option
is no longer parsed correctly (true of grow mode as well).  This happens
because when you switch the short opts to the bitmap_auto version, it
specifies that the argument must follow a, yet the loop expects to get
an undecorated option and parse it as the disk dev instead of trying to
parse optarg.  So, create a new short opt array that is used for manage
and grow that doesn't list a as having an argument.

13 years agoMark some files FD_CLOEXEC to protect sendmail from them.
Doug Ledford [Sun, 8 Jul 2007 23:59:54 +0000 (09:59 +1000)] 
Mark some files FD_CLOEXEC to protect sendmail from them.

From: Doug Ledford <>

When running with SELinux enabled and using mdadm to monitor devices,
attempts to send emails to an admin will be blocked because mdadm is
holding open /proc/mdstat without setting the FD_CLOEXEC flag.  As a
result, sendmail has an open descriptor to /proc/mdstat after the
popen() call, which SELinux decides isn't really any of sendmail's
business and so sendmail gets denied.

13 years agoImprove error message when trying to create an array that already exists.
Doug Ledford [Sun, 8 Jul 2007 23:59:50 +0000 (09:59 +1000)] 
Improve error message when trying to create an array that already exists.

From: Doug Ledford <>

Simple bugfix.  If an array already exists and we are asked to create
this array, error out with an error message that makes sense to people
instead of an error that the SET_ARRAY_INFO ioctl had an invalid
argument.  Plus a typo correction.

13 years agoInterpret "--metadata=1" with --assemble to imply any version-1, not just 1.0
Doug Ledford [Sun, 8 Jul 2007 23:59:47 +0000 (09:59 +1000)] 
Interpret "--metadata=1" with --assemble to imply any version-1, not just 1.0

From: Doug Ledford <>

OK, this one fixes an issue where people were doing manual array
creation and specifying superblock types other than 1.0 (aka, 1.1, 1.2)
and then using mdadm -Ebs to populate their mdadm.conf file.  The
general problem is that if you specify a superblock type in the ARRAY
line (or on the command line), then you must specify the superblock type
*exactly*, including the minor version.  Unfortunately, mdadm -Ebs
prints out all version 1 superblocks, regardless of minor version, as
just plain old 1.  This breaks the mdadm.conf file for anything other
than plain version 1 superblock devices.

So, since I thought it was basically backwards that the mdadm -E output
was lax on specifying the location of the superblock where as the mdadm
-A input was strict, I reversed that.  With this patch, the mdadm -E
output is now exact for any given superblock.  But, in addition, the
mdadm -A input is now lax for any superblock that doesn't specifically
list the minor version, aka version 1 now means version 1, not version
0.90, but any minor version.  So does default/large.

13 years agoFix spare migration and other problems with --monitor.
Neil Brown [Sun, 8 Jul 2007 23:59:42 +0000 (09:59 +1000)] 
Fix spare migration and other problems with --monitor.

2.6 broke --monitor in various ways, including spare migration
stopped working.  This fixes it.