Merge branch 'master' into devel-3.1

Conflicts:
	mdadm.8
This commit is contained in:
NeilBrown 2009-10-01 16:58:40 +10:00
commit ca4f89a3b7
74 changed files with 1053 additions and 2765 deletions

View File

@ -1,41 +0,0 @@
Subject: ANNOUNCE: mdadm 2.0 - A tool for managing Soft RAID under Linux
I am (at last) please to announce the availability of
mdadm version 2.0
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.0 contains a substantial rewrite of various pieces of
functionality, particularly the --create option. This enables support
for a new style of superblock - the version-1 superblock.
Version-1 can support many more than 28 devices and can be easily
moved between hosts with different endian-ness.
Release 2.0 also contains support for the recent bitmap-intent-logging
which will appear in 2.6.13, and the RAID1 write-behind that will be
available in 2.6.14 (it is currently only in -mm).
This release comes with a test-suite which has been used to verify that
mdadm-2.0 actually works in a number of common scenarios. Some of the
tests require a bleeding-edge kernel, so don't be surprised if some fail
on kernels prior to 2.6.14.
Being a '.0' release, 2.0 should be treated with some caution.
However I believe it is quite stable and can safely be used on
production systems.
Note that this release is "2.0", not "2.0.0". I never found a use for
the third number with 1.X.Y, so I dropped it.
Development of mdadm has moved from CSE@UNSW and is now sponsored by
SUSE Labs, Novell Inc.
NeilBrown 26th August 2005

View File

@ -1,37 +0,0 @@
Subject: ANNOUNCE: mdadm 2.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.1 fixes a few problems found after the release of 2.0.
If you are using raid10 or version-1 superblocks and upgrade is
recommended.
Specifically:
- Fix assembling of raid10 array when devices are missing.
mdadm now correctly detects if a array is workable or not
depending on which devices are present, and so will correctly
handle "--assemble --force" if multiple devices have failed.
- Report raid10 layout in --examine output.
- Fix assembling of arrays that use the version-1 superblock and
have spares. Previously the spares would be ignored.
- Fix bug so that multiple drives can be re-added at once.
- Fix problem with hot-adding a bitmap to version-1-superblock
arrays.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 12th September 2005

View File

@ -1,50 +0,0 @@
Subject: ANNOUNCE: mdadm 2.2 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.2
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.2 fixes a few small bugs and add as few small elements of
functionality. Possibly the most interesting is the addition of
'README.initramfs' and 'mkinitramfs'. Feedback on these would be
most welcome.
Changelog Entries:
- Assorted bug fixes
- Support write-intent-bitmaps on raid10
- Support little-endian (Rather than hostendian) bitmaps.
- Return correct error code from 'mdadm -S'
- Remove extra blank line from 'mdadm -Eb' output.
- Improve option parsing so that -a and -b do not have
optional arguements: the arg is either required or not
depending on context.
- Allow scanning of devices listed in /proc/partitions even
if they don't appear in /dev.
- Support --assume-clean in --create mode as well as --build
- Add support for --monitor to report to syslog: -y or --syslog.
Thanks to Ross Vandegrift
- --monitor now reports which device failed in a 'Fail' message
This broke with 2.6
- Improve chance of array starting properly after a crash.
mdadm was insisting the event numbers were identical, but this
isn't needed, and is a problem if the crash was while the metadata
was being updated.
- Support --update==uuid
- Added README.initramfs and mkinitramfs to help people use an
initram for starting md arrays at boot.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 5th December 2005

View File

@ -1,49 +0,0 @@
Subject: ANNOUNCE: mdadm 2.3 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.3
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.3 fixes an assortment of bugs including the "--assemble --scan"
crash. It also makes mdadm better at handling very large arrays.
Finally, it adds some functionality to support some pending kernel
features such as raid5 reshaping.
Changelog Entries:
- Try /etc/mdadm/mdadm.conf if /etc/mdadm.conf doesn't exist.
This provided compatability for Debian.
- Fixed for version-1 superblock:
report chunksize for raid6 and raid10
make sure device size used is a multiple of chunksize
- Fix "--assemble --scan" crash.
- Fix completely failure to create array on ppc64
- Fix memcmp in place of memcpy
- A few minor improvements to online help
- Clean up usage of 'long long' for used-size of devices, so
that it is possible to create a raid1 of 7TB devices!
- Make internal bitmaps work on 7TB raid1 arrays.
- Provide error message if --examine doesn't find any superblock.
- Report 'reshape' status in --examine - this depends on kernel
patches that are not yet finalised.
- Report bitmap status in --detail and --examine
- Default to v1 superblocks instead of v0.90 if the array
is too big for 0.90 to handle.
- Sort the output of "mdadm --detail --scan" so that it is
in a suitable order for assembling arrays. i.e. components come
before an array that they are part of.
- Print size of large reiserfs array properly went warning of
possible confilcts.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 2nd February 2006

View File

@ -1,31 +0,0 @@
Subject: ANNOUNCE: mdadm 2.3.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.3.1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.3.1 primarily fixes a few compile problems with 2.3. Though
there are some functionality changes, they are extremely minor and you
probably won't notice them.
Changelog Entries:
- Fixed -O2 compile so I could make and RPM.
- Type cast number to be printed %llu so it compiles on 64bit
machines. (Thanks Luca).
- Stop using asm/byteorder.h - to make Redhat happy :-(
- Require bitmap files to have a '/' in their name.
- Error-check a few syscalls - code from SuSE package.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 6th February 2006

View File

@ -1,45 +0,0 @@
Subject: ANNOUNCE: mdadm 2.4 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.4
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.4 primarily adds support for increasing the number of
devices in a RAID5 array, which requires 2.6.17 (or some -rc or -mm
prerelease).
It also includes a number of minor functionality enhancements and
documentation updates.
Changelog Entries:
- Rewrite 'reshape' support including performing a backup
of the critical region for a raid5 growth, and restoring that
backup after a crash.
- Put a 'canary' at each end of the backup so a corruption
can be more easily detected.
- Remove useless 'ident' arguement from ->getinfo_super method.
- Support --backup-file for backing-up critical section during
growth.
- Erase old superblocks (of different versions) when creating new
array.
- Allow --monitor to work with arrays with >28 devices
- Report reshape information in --detail
- Handle symlinks in /dev better
- Fix mess in --detail output which a device is missing.
- Manpage tidyup
- Support 'bitmap=' in mdadm.conf for auto-assembling arrays with
write-intent bitmaps in separate files.
- Updates to md.4 man page including section on RESTRIPING and SYSFS
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 30th March 2006

View File

@ -1,24 +0,0 @@
Subject: ANNOUNCE: mdadm 2.4-pre1 - development release for testing only
I am somewhat cautious in announcing the availability of
mdadm version 2.4-pre1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
pre-release 2.4-pre1 contains support for growing a raid5 array i.e.
adding extra drives and restriping the whole arrays.
This requires a kernel more recent than 2.6.16-rc6-mm2.
During a restripe, there is a crtical section at the start where a
system crash can leave the contents of the raid5 unrecoverable. This
version of mdadm will backup that section, and can restore it when
reassembling the array after a crash.
Have fun, but use it carefully and report any problems.
NeilBrown 20th March 2006

View File

@ -1,31 +0,0 @@
Subject: ANNOUNCE: mdadm 2.4.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.4.1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
2.4.1 primarily fixes an alignment problem in the version-1
superblock. This is an incompatible change relating to
raid5-reshape. Read the change log below.
Changelog Entries:
- Honour --write-mostly when adding to an array without persistent
superblocks.
- Fix alignment problem in version-1 superblocks.
NOTE: This is an incompatable change affecting raid5 reshape.
If you want to reshape a raid5 using version-1 superblocks,
use 2.6.17-rc2 or later, and mdadm-2.4.1 or later.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 7th April 2006

View File

@ -1,67 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5 adds a host of minor updates and one major update.
The major update involves an "Auto Assemble" function which will,
with certainly limits, scan all available devices for anything that
looks like an md array, and will try to assemble it.
This code should be treated with some caution as it is very new,
and could be revised in future, though hopefully not very much.
The main problem I have always had will auto-assembly is that it
is too easy for it to assemble thing that you don't want assembled,
e.g. if you have moved some devices from a different computer.
To remove this problem, arrays can now be tagged for the computer
that is their home (homehost) and only arrays with the correct
homehost will be auto-assembled.
Feedback on the effectiveness and usefulness of this feature and it's
documentation is encouraged.
Changelog Entries:
- Support 'mailfrom' line in mdadm.conf so the From: line in alert
emails can be explicitly set.
- Arrange that SparesMissing (which is similar in import to
DegradedArray) generates an Email.
- Assume "DEVICE partitions" if no DEVICE line is given.
- Support new 'offset' layout for raid10.
- When creating a bitmap file, choose a chunksize to limit number
of bitmap chunks to 2 million. More than this can cause kmalloc
failure.
- New 'CREATE' line in mdadm.conf for defaults such as owner, group,
mode and auto-flag
- --detail checks if array has been started or not and includes that
in report.
- When using --update=uuid on an array with a bitmap, update the
bitmap's uuid too.
- Add a copy of /proc/mdstat to the mail message sent by mdadm
--monitor.
- New flag --no-degraded to avoid starting arrays if there are
fewer devices available than last time the array was started.
This is only needed with --scan, as with --scan, that behaviour
is the default.
- Support for 'homehost' concept. This is a fairly major update.
It includes a configfile option and a command line option for
specifying a homehost, records that host in the superblock,
and reports the homehost where possible.
- Support for Auto Assembly. "mdadm -As" will, if provided with
the name of a homehost, try to assemble all arrays it can find
that were created for that homehost. See man pages for more details.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 26th May 2006

View File

@ -1,40 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/git/mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.1 adds multiple minor updates including a couple of bugfixes.
Changelog Entries:
- Various fixes for gcc warnings
- uclibc warnings
- Makefile improvements for static linking/intalling
- Makefile uninstall target
- Really fix return status of --examine
- Typos
- Byteorder stuff (again)
- Don't try to create devices with --manage or --grow
- allow default metadata (superblock) type to be specified
in mdadm.conf
- Get --stop to list devices stopped but honour --quiet
- remove libssl dependency
- Avoid some misdetection of overlapping partitions
- Fix memory leak in --monitor mode
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 16th June 2006

View File

@ -1,45 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.2 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.2
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.2 is primarily a bugfix release over 2.5.1.
It also contains a work-around for a kernel bug which affects
hot-adding to arrays with a version-1 superblock.
Changelog Entries:
- Fix problem with compiling with gcc-2 compilers
- Fix compile problem of post-incrmenting a variable in a macro arg.
- Stop map_dev from returning [0:0], as that breaks things.
- Add 'Array Slot' line to --examine for version-1 superblocks
to make it a bit easier to see what is happening.
- Work around bug in --add handling for version-1 superblocks
in 2.6.17 (and prior).
- Make -assemble a bit more resilient to finding strange
information in superblocks.
- Don't claim newly added spares are InSync!! (don't know why that
code was ever in there)
- Work better when no 'ftw' is available, and check to see
if current uclibc provides ftw.
- Never use /etc/mdadm.conf if --config file is given (previously
some code used one, some used the other).
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 27th June 2006

View File

@ -1,33 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.3 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.3
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.3 is a bugfix release over 2.5.2.
Changelog Entries:
- Document v0.91 superblocks in md.4
- Make GPL explicit in man pages.
- Fix recent breakage of starting degraded arrays.
- Tidyup automatic name choice for v-1 arrays:
/dev/md_d0 now becomes '0', not '_d0'.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 7th August 2006

View File

@ -1,38 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.4 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.4
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.4 is a bugfix release over 2.5.3
Changelog Entries:
- When creating devices in /dev/md/ create matching symlinks
from /dev. e.g. /dev/md0 -> /dev/md/0.
Allow this to be disabled in mdadm.conf or on command line.
- Fix some endian-ness issues with version-1 superblocks (affects
bigendian only).
- Fix endian problem with 'bitmap' metadata
- Allow a number (of partitions) after the 'yes' option to --auto=
This is particularly useful in the 'create' line in mdadm.conf.
- Remove partitions from any whole device that is made part of
an md array. This is a work-around for annoying messages
when the first block on some drive accidentally looks like a
partition table.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 13th October 2006

View File

@ -1,43 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.5 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.5
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.5 is a bugfix release over 2.5.4.
Hopefully the last before 2.6.
Changelog Entries:
- Don't #include linux/blkpg.h as that isn't safe. Just
include the content literally.
- Reduce maximum bitmap usage when working with bitmap files,
so that a only single-page allocations are made, even on
64bit hosts with 4K pages.
- Close stray fd in mdassemble so that it can assemble stacked
devices
- If mdassemble finds an array already assembled, it marks it
read-write.
- Remove error in md_open if array is already active. This isn't
needed and gets in the ways if an array was created e.g. in
initramfs, but device doesn't yet exist in /dev.
- When --assemble --scan is run, if all arrays that could be found
have already been started, don't report an error.
- Fix a couple of bugs related to raid10 and the new 'offset' layout.
- Improve error message when a wrong '--update' option is given.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 23rd October 2006

View File

@ -1,32 +0,0 @@
Subject: ANNOUNCE: mdadm 2.5.6 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.5.6
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.5.6 is a bugfix release over 2.5.5, which it turns out
wasn't the last before 2.6. Maybe this one?
Changelog Entries:
- Fix bug which meant "bitmap=xxx" in mdadm.conf was not handled
properly.
- Documentation updates.
- Fix bug that caused infinite loop when doing auto-assembly,
in certain cases where arrays couldn't be assembled.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 6th November 2006

View File

@ -1,76 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6 adds assorted fixes and improvements and a new major mode.
"Incremental Assembly" via -I or --incremental can be used to
assemble an array one device at a time. The idea is that you get
udev to run "mdadm -Iq devicename" on each new block device that it
finds. Anything that is part of an array gets included in an array as
appropriate.
Two special notes:
1/ This is very new code and is probably buggy. It passes a few basic
tests, and helped me find some kernel bugs, but it is still fresh
and should not be considered 'stable'. Please test and provide
feedback.
2/ There is a bug in the linux kernel that makes incremental assembly
not possible in general (you cannot safely remove a drive from an array
that has not yet been started. This is needed if an old device was
detected first). If mdadm detects a kernel which might have the
bug, it rejects --incremental requests.
The bug will hopefully be fixed in 2.6.20 and this mdadm release
contains patches for 2.6.18, 2.6.18.6 and 2.6.19. Apply the
appropriate patch to test --incremental.
Changelog Entries:
- Fixed UUID printing in "--detail --brief" for version1 metadata.
- --update=resync did exactly the wrong thing for version1 metadata.
It caused a resync to not happen, rather than to happen.
- Allow --assemble --force to mark a raid6 clean when it has two
missing devices (which is needed else if won't assemble.
Without this fix it would only assemble if one or zero
missing devices.
- Support --update=devicesize for cases where the underlying device
can change size.
- Default to --auto=yes so the array devices with 'standard' names
get created automatically, as this is almost always what is wanted.
- Give useful message if raid4/5/6 cannot be started because it is
not clean and is also degraded.
- Increase raid456 stripe cache size if needed to --grow the array.
The setting used unfortunately requires intimate knowledge of the
kernel, and it not reset when the reshape finishes.
- Change 'Device Size' to 'Used Dev Size' because it only shows how
much of each device is actually used, not how big they are.
- --wait or -W will wait for resync activity to finish on the given
devices.
- Fix some problems with --update=uuid and add a test.
- If two drives in a raid5 disappear at the same time, then "-Af"
will add them both in rather than just one and forcing the array
to 'clean'. This is slightly safer in some cases.
- Check device is large enough before hot-add: this improves quality
of error message.
- Don't hold md device open for so long in --monitor mode - map_dev
can be slow and interferes with trying to stop the array.
- Support --uuid= with --create to choose your own UUID.
- New major more "--incremental" for incremental assemble of arrays,
intended for use with udev.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 21st December 2006
Blessed Christmas to all.

View File

@ -1,33 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.1
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.1 adds a few minor bug fixes to 2.6 including improved
support for growing a RAID6 array.
Changelog Entries:
- --monitor was producing some meaningless warnings due to a bug.
- Fix some compiler warnings.
- Fully support --grow for raid6. If a reshape crashed during the
critical period, mdadm wouldn't restore the Q information
properly.
- Update documentation for --grow.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 22nd February 2007

View File

@ -1,37 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.2 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.2
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.2 adds a few minor bug fixes to 2.6.1
Changelog Entries:
- --fail detached and --remove faulty can be used to fail and
remove devices that are no longer physically present.
- --export option for --detail or present information in a format
that can be processed by udev.
- fix internal bitmap allocation problems with v1.1, v1.2 metadata.
- --help now goes to stdout so you can direct it to a pager.
- Various manpage updates.
- Make "--grow --add" for linear arrays really work.
- --auto-detect to trigger in-kernel autodetect.
- Make return code for "--detail --test" more reliable. Missing
devices as well as failed devices cause an error.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 21st May 2007

View File

@ -1,44 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.3 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.3
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.3 adds a few minor bug fixes to 2.6.2
Changelog Entries:
- allow --write-behind to be set for --grow.
- 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).
- When adding a drive that was a little too small, we did not get
the correct error message.
- 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.
- Fix segfault with '--detail --export' and non-persistent
superblocks.
- Various manpage updates.
- Improved 'raid4' support (--assemble, --monitor)
- Option parsing fixes w.r.t -a
- Interpret "--assemble --metadata=1" to allow any version 1.x
metadata, and be more specific in the "metadata=" message printed
with --examine --brief
- Fix spare migration in --monitor.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 20th August 2007

View File

@ -1,31 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.4 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.4
It is available at the usual places:
http://www.cse.unsw.edu.au/~neilb/source/mdadm/
and
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.4 adds a few minor bug fixes to 2.6.3
Changelog Entries:
- Make "--create --auto=mdp" work for non-standard device names.
- Fix restarting of a 'reshape' if it was stopped in the middle.
- Fix a segfault when using v1 superblock.
- Make --write-mostly effective when re-adding a device to an array.
- Various minor fixes
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 19th October 2007

View File

@ -1,40 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.5 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.5
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.5 adds a few minor bug fixes to 2.6.4
Changelog Entries:
- Avoid segfault when parsing /proc/mdstat with auto-read-only
arrays.
- Fix problem with failing to add devices to v.large (>4TB) arrays,
cause by problems with device-size overflow.
- For v0.90 superblocks, print the 'Events' count as a real count,
not 2 numbers separated by a dot.
- Updates some URLs in the man page.
- Allow creation of a RAID6 with exactly one missing device.
- Use LOG_PID for syslog, so you get the pid of mdadm in the log
files.
- --export now works with --examine too (not just --detail)
- Improve auto-creation of device special file when using
--incremental
- Simple locking for --incremental so mdadm doesn't get confused
when run concurrently with itself.
- Make --incremental cope better with arrays that are being reshaped.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 15th May 2007

View File

@ -1,27 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.6 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.6
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.6 fixes a compile problem in 2.6.5 and adds a small manpage update.
Changelog Entries:
- "make everything" now make mdassemble.auto
- fix compile problem with mdassemble.auto
- Update FAQ URLs in man page again.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 19th May 2007

View File

@ -1,27 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.7 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.7
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.7 fixes a few bugs in 2.6.5 which 2.6.6 didn't fix.
Changelog Entries:
- Avoid NULL reference calling free_super and elsewhere.
- Remove stray semicolon (Causes compile error with gcc-2.95)
- Fix autoassemble for stack arrays.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 6th June 2008

View File

@ -1,58 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.8 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.8
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.8 contains various bug fixes and minor enhancements.
It is possibly that 2.6.8 will be the last release in the 2.x
series and very likely that there will never be a 2.7.
Hopefully 3.0 will be released soon making future development
of 2.6.x unnecessary. However if a need does arise for a 2.6.9
it will be considered.
Changelog Entries:
fix add_dev() handling of broken links
Assemble: allow --force to work even when event counts are 0.
mapfile: fix bug in testing for /var/run/mdadm/
Incremental: change precedence order for autof setting.
Adjust major number testing to allow for extended minor number in 2.6.28
Incremental: allow assembly of foreign array.
Incremental: fix setting of 'autof' flag.
Fix --incremental assembly of partitions arrays.
Fix NULL pointer oops
Fix bad metadata formatting
Allow WRITEMOSTLY to be cleared on --readd using --readwrite.
Remove .UR .UE macros from man page because the don't do what we want.
Grow: Fix linear-growth when devices are not all the same size.
Improve reporting of layout for raid10.
Manage: allow adding device that is just large enough to v1.x array.
Cosmetic cleanup of some messages.
Clean up usage of open()
Add support for distribution specific build extensions
Fix confusing usage in md.4 man page.
Describe the HOMEHOST entry in the mdadm.conf man page.
Some more cleanup of tests.
Add test for stoping and restarting a raid5 reshape.
Add "bitmap=" to "--detail --brief" output when relevant.
Improve error message when mdadm fails to stop an array.
Couple more man page fixes
Add text to man pages suggesting partition type to use for version 1.x metadata.
Italic/bold fixes in man pages.
Fix bug in forced assemble.
Fix an error when assembling arrays that are in the middle of a reshape.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 28th November 2008

View File

@ -1,51 +0,0 @@
Subject: ANNOUNCE: mdadm 2.6.9 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.9
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.9 contains various bug fixes.
Clearly 2.6.8 was not the final 2.x release.
Hopefully 2.6.9 will be as I don't want go to 2.7, and
2.6.10 might be confusing (though I'll probably go that
way if I need to).
New features will only appear in the 3.x series of which 3.0 will be
release within a few months.
Changelog Entries:
Bernhard Reutner-Fischer (1):
mdadm fix compilation for uClibc
Dustin Kirkland (2):
Fail overtly when asprintf fails to allocate memory
Typo in earlier patch : asprintf -> vasprintf
NeilBrown (11):
Allow --config in --incremental mode.
Kill: Don't use O_EXCL when --force is used.
Assemble: don't assume array is 'clean' unless all devices think it is.
Assemble: set stripe_cache_size properly when restarting a reshape.
map: rebuild map if it doesn't exist.
Free mdstat data structures properly.
Fix the used device size in mdadm -D output.
Document 'max' option to --grow --size in --help output.
Fix possible crash if bitmap metadata is bad.
Monitor: send --test message for arrays in /proc/mdstat that aren't in mdadm.conf
super1: make sure max_dev grows enough when adding a device to an array.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 28th November 2008

View File

@ -1,7 +1,7 @@
Subject: ANNOUNCE: mdadm 3.0-devel2 - A tool for managing Soft RAID under Linux
Subject: ANNOUNCE: mdadm 3.0 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0-devel2
I am pleased to (finally) announce the availability of
mdadm version 3.0
It is available at the usual places:
countrycode=xx.
@ -10,8 +10,11 @@ and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
Note that this is a "devel" release. It should be used with
caution, though it is believed to be close to release-candidate stage.
This is a major new version and as such should be treated with some
caution. However it has seen substantial testing and is considerred
to be ready for wide use.
The significant change which justifies the new major version number is
that mdadm can now handle metadata updates entirely in userspace.
@ -28,7 +31,7 @@ If udev is installed on the system, mdadm will not create any devices
in /dev. Rather it allows udev to manage those devices. For this to work
as expected, the included udev rules file should be installed.
If udev is not install, mdadm will still create devices and symlinks
If udev is not installed, mdadm will still create devices and symlinks
as required, and will also remove them when the array is stopped.
mdadm now requires all devices which do not have a standard name (mdX
@ -92,7 +95,4 @@ versions for mdadm are still supported and the kernel still performs
the same updates it use to. The new 'mdmon' approach is only used for
newly introduced metadata types.
Any testing and feedback will be greatly appreciated.
NeilBrown 5th November 2008
NeilBrown 2nd June 2009

View File

@ -1,84 +0,0 @@
Subject: ANNOUNCE: mdadm 3.0-devel1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0-devel1
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
Note that this is a "devel" release. It is not intended for
production use yet, but rather for testing and ongoing development.
The significant change which justifies the new major version number is
that mdadm can now handle metadata updates entirely in userspace.
This allows mdadm to support metadata formats that the kernel knows
nothing about.
Currently two such metadata formats are supported:
- DDF - The SNIA standard format
- Intel Matrix - The metadata used by recent Intel ICH controlers.
The manual pages have not yet been updated, but here is a brief outline.
Externally managed metadata introduces the concept of a 'container'.
A container is a collection of (normally) physical devices which have
a common set of metadata. A container is assembled as an md array, but
is left 'inactive'.
A container can contain one or more data arrays. These are composed from
slices (partitions?) of various devices in the container.
For example, a 5 devices DDF set can container a RAID1 using the first
half of two devices, a RAID0 using the first half of the remain 3 devices,
and a RAID5 over thte second half of all 5 devices.
A container can be created with
mdadm --create /dev/md0 -e ddf -n5 /dev/sd[abcde]
or "-e imsm" to use the Intel Matrix Storage Manager.
An array can be created within a container either by giving the
container name and the only member:
mdadm -C /dev/md1 --level raid1 -n 2 /dev/md0
or by listing the component devices
mdadm -C /dev/md2 --level raid0 -n 3 /dev/sd[cde]
The assemble a container, it is easiest just to pass each device in turn to
mdadm -I
for i in /dev/sd[abcde]
do mdadm -I $i
done
This will assemble the container and the components.
Alternately the container can be assembled explicitly
mdadm -A /dev/md0 /dev/sd[abcde]
Then the components can all be assembled with
mdadm -I /dev/md0
For each container, mdadm will start a program called "mdmon" which will
monitor the array and effect any metadata updates needed. The array is
initially assembled readonly. It is up to "mdmon" to mark the metadata
as 'dirty' and which the array to 'read-write'.
The version 0.90 and 1.x metadata formats supported by previous
versions for mdadm are still supported and the kernel still performs
the same updates it use to. The new 'mdmon' approach is only used for
newly introduced metadata types.
Any testing and feedback will be greatly appreciated.
NeilBrown 18th September 2008

View File

@ -1,113 +0,0 @@
Subject: ANNOUNCE: mdadm 3.0-devel3 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0-devel3
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
Note that this is a "devel" release. It should be used with
caution, though it is believed to be close to release-candidate stage.
There have been numerous improvements and additions since -devel2.
I think we are close to a release of 3.0.
I need to add lots of tests to the test suite to test the new
functionality. And I need to review the man pages.
After that I will release -rc1 followed by -final.
The following is the same introduction to 3.x as appeared in
previous announcements.
Any testing and feedback will be greatly appreciated.
NeilBrown 10th March 2009
=====================================================
The significant change which justifies the new major version number is
that mdadm can now handle metadata updates entirely in userspace.
This allows mdadm to support metadata formats that the kernel knows
nothing about.
Currently two such metadata formats are supported:
- DDF - The SNIA standard format
- Intel Matrix - The metadata used by recent Intel ICH controlers.
Also the approach to device names has changed significantly.
If udev is installed on the system, mdadm will not create any devices
in /dev. Rather it allows udev to manage those devices. For this to work
as expected, the included udev rules file should be installed.
If udev is not install, mdadm will still create devices and symlinks
as required, and will also remove them when the array is stopped.
mdadm now requires all devices which do not have a standard name (mdX
or md_dX) to live in the directory /dev/md/. Names in this directory
will always be created as symlinks back to the standard name in /dev.
The man pages contain some information about the new externally managed
metadata. However see below for a more condensed overview.
Externally managed metadata introduces the concept of a 'container'.
A container is a collection of (normally) physical devices which have
a common set of metadata. A container is assembled as an md array, but
is left 'inactive'.
A container can contain one or more data arrays. These are composed from
slices (partitions?) of various devices in the container.
For example, a 5 devices DDF set can container a RAID1 using the first
half of two devices, a RAID0 using the first half of the remain 3 devices,
and a RAID5 over thte second half of all 5 devices.
A container can be created with
mdadm --create /dev/md0 -e ddf -n5 /dev/sd[abcde]
or "-e imsm" to use the Intel Matrix Storage Manager.
An array can be created within a container either by giving the
container name and the only member:
mdadm -C /dev/md1 --level raid1 -n 2 /dev/md0
or by listing the component devices
mdadm -C /dev/md2 --level raid0 -n 3 /dev/sd[cde]
To assemble a container, it is easiest just to pass each device in turn to
mdadm -I
for i in /dev/sd[abcde]
do mdadm -I $i
done
This will assemble the container and the components.
Alternately the container can be assembled explicitly
mdadm -A /dev/md0 /dev/sd[abcde]
Then the components can all be assembled with
mdadm -I /dev/md0
For each container, mdadm will start a program called "mdmon" which will
monitor the array and effect any metadata updates needed. The array is
initially assembled readonly. It is up to "mdmon" to mark the metadata
as 'dirty' and which the array to 'read-write'.
The version 0.90 and 1.x metadata formats supported by previous
versions for mdadm are still supported and the kernel still performs
the same updates it use to. The new 'mdmon' approach is only used for
newly introduced metadata types.

View File

@ -1,139 +0,0 @@
Subject: ANNOUNCE: mdadm 3.0-rc1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0-rc1
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
This is a "release candidate" which means that I think it is safe
to use and that there will be no significant change in functionality
before release.
The man pages aren't really "release candidate" yet but I will be
working on them before the final release.
The most significant changes since -devel3 relate to the names of md
devices as they appear in /dev and /dev/md/, and in particular the names
that are used when an array is assembled with "--incremental" or with
"mdadm --assemble --scan" when there are no ARRAY lines in mdadm.conf.
In these cases mdadm needs to deduce a name to use, and to try to
avoid using a name that a different array might have a stronger claim to.
The rules are:
- if the array is mentioned in mdadm.conf, use the name given there.
- if the array appear to have been created for "this host" using the
"homehost" concept, trust the name given in the metadata
- if the new setting "HOMEHOST <ignore>" is given (can be in mdadm.conf
or on command line) the the name given in the metadata is not
associated with some other array by mdadm.conf, then trust the
name given in the metadata
- otherwise use the name in the metadata, but in an untrusted manner.
If a name is untrusted, or if the name is already in use by another
array, then a numeric suffix like "_0", "_1" is appended to create
a unique name for the array.
That name is then used to create a device file in /dev/md/.
So if all arrays needed for boot will always be listed in
/etc/mdadm.conf, then it is appropriate to add "HOMEHOST <ignore>" to
mdadm.conf and there is no risk of conflicting names. However if you
want auto-assemble to assemble all arrays at boot time and you don't
want to list them in mdadm.conf, then don't give "HOMEHOST <ignore>"
either else there could be a risk of the wrong array being assembled
for a given name.
The following is the same introduction to 3.x as appeared in
previous announcements.
Any testing and feedback will be greatly appreciated.
NeilBrown 11th May 2009
=====================================================
The significant change which justifies the new major version number is
that mdadm can now handle metadata updates entirely in userspace.
This allows mdadm to support metadata formats that the kernel knows
nothing about.
Currently two such metadata formats are supported:
- DDF - The SNIA standard format
- Intel Matrix - The metadata used by recent Intel ICH controlers.
Also the approach to device names has changed significantly.
If udev is installed on the system, mdadm will not create any devices
in /dev. Rather it allows udev to manage those devices. For this to work
as expected, the included udev rules file should be installed.
If udev is not install, mdadm will still create devices and symlinks
as required, and will also remove them when the array is stopped.
mdadm now requires all devices which do not have a standard name (mdX
or md_dX) to live in the directory /dev/md/. Names in this directory
will always be created as symlinks back to the standard name in /dev.
The man pages contain some information about the new externally managed
metadata. However see below for a more condensed overview.
Externally managed metadata introduces the concept of a 'container'.
A container is a collection of (normally) physical devices which have
a common set of metadata. A container is assembled as an md array, but
is left 'inactive'.
A container can contain one or more data arrays. These are composed from
slices (partitions?) of various devices in the container.
For example, a 5 devices DDF set can container a RAID1 using the first
half of two devices, a RAID0 using the first half of the remain 3 devices,
and a RAID5 over thte second half of all 5 devices.
A container can be created with
mdadm --create /dev/md0 -e ddf -n5 /dev/sd[abcde]
or "-e imsm" to use the Intel Matrix Storage Manager.
An array can be created within a container either by giving the
container name and the only member:
mdadm -C /dev/md1 --level raid1 -n 2 /dev/md0
or by listing the component devices
mdadm -C /dev/md2 --level raid0 -n 3 /dev/sd[cde]
To assemble a container, it is easiest just to pass each device in turn to
mdadm -I
for i in /dev/sd[abcde]
do mdadm -I $i
done
This will assemble the container and the components.
Alternately the container can be assembled explicitly
mdadm -A /dev/md0 /dev/sd[abcde]
Then the components can all be assembled with
mdadm -I /dev/md0
For each container, mdadm will start a program called "mdmon" which will
monitor the array and effect any metadata updates needed. The array is
initially assembled readonly. It is up to "mdmon" to mark the metadata
as 'dirty' and which the array to 'read-write'.
The version 0.90 and 1.x metadata formats supported by previous
versions for mdadm are still supported and the kernel still performs
the same updates it use to. The new 'mdmon' approach is only used for
newly introduced metadata types.

22
ANNOUNCE-3.0.1 Normal file
View File

@ -0,0 +1,22 @@
Subject: ANNOUNCE: mdadm 3.0.1 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0.1
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
This contains only minor bug fixes over 3.0. If you are using
3.0, you could consider upgrading.
The brief change log is:
- Fix various segfaults
- Fixed for --examine with containers
- Lots of other little fixes.
NeilBrown 25th September 2009

21
ANNOUNCE-3.0.2 Normal file
View File

@ -0,0 +1,21 @@
Subject: ANNOUNCE: mdadm 3.0.2 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 3.0.2
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
This just contains one bugfix over 3.0.1 - I was obviously a bit hasty
in releasing that one.
The brief change log is:
- Fix crash when hosthost is not set, as often happens in
early boot.
NeilBrown 25th September 2009

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -188,6 +183,8 @@ int Assemble(struct supertype *st, char *mddev,
if (!devlist &&
ident->uuid_set == 0 &&
ident->super_minor < 0 &&
ident->name[0] == 0 &&
(ident->container == NULL || ident->member == NULL) &&
ident->devices == NULL) {
fprintf(stderr, Name ": No identity information available for %s - cannot assemble.\n",
mddev ? mddev : "further assembly");
@ -323,6 +320,8 @@ int Assemble(struct supertype *st, char *mddev,
content = tmpdev->content;
else
content = tst->ss->container_content(tst);
if (!content)
goto loop; /* empty container */
tmpdev->content = content->next;
if (tmpdev->content == NULL)

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"

784
ChangeLog
View File

@ -1,770 +1,20 @@
Changed Prior to this release
- --readwrite can be used with --re-add to clear the writemostly
flag.
Please see git logs for detailed change log.
This file just contains highlight.
Changes Prior to 2.6.7 release
- Avoid NULL reference calling free_super and elsewhere.
- Remove stray semicolon (Causes compile error with gcc-2.95)
- Fix autoassemble for stack arrays.
Changes Prior to release 3.0.2
- Fix crash when hosthost is not set, as often happens in
early boot.
Changes Prior to 2.6.6 release
- "make everything" now make mdassemble.auto
- fix compile problem with mdassemble.auto
- Update FAQ URLs in man page again.
Changes Prior to 2.6.5 release
- Avoid segfault when parsing /proc/mdstat with auto-read-only
arrays.
- Fix problem with failing to add devices to v.large (>4TB) arrays,
cause by problems with device-size overflow.
- For v0.90 superblocks, print the 'Events' count as a real count,
not 2 numbers separated by a dot.
- Updates some URLs in the man page.
- Allow creation of a RAID6 with exactly one missing device.
- Use LOG_PID for syslog, so you get the pid of mdadm in the log
files.
- --export now works with --examine too (not just --detail)
- Improve auto-creation of device special file when using
--incremental
- Simple locking for --incremental so mdadm doesn't get confused
when run concurrently with itself.
- Make --incremental cope better with arrays that are being reshaped.
Changes Prior to 2.6.4 release
- Make "--create --auto=mdp" work for non-standard device names.
- Fix restarting of a 'reshape' if it was stopped in the middle.
- Fix a segfault when using v1 superblock.
- Make --write-mostly effective when re-adding a device to an array.
- Various minor fixes
Changes Prior to 2.6.3 release
- allow --write-behind to be set for --grow.
- 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).
- When adding a drive that was a little too small, we did not get
the correct error message.
- 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.
- Fix segfault with '--detail --export' and non-persistent
superblocks.
- Various manpage updates.
- Improved 'raid4' support (--assemble, --monitor)
- Option parsing fixes w.r.t -a
- Interpret "--assemble --metadata=1" to allow any version 1.x
metadata, and be more specific in the "metadata=" message printed
with --examine --brief
- Fix spare migration in --monitor.
Changes Prior to 2.6.2 release
- --fail detached and --remove faulty can be used to fail and
remove devices that are no longer physically present.
- --export option for --detail or present information in a format
that can be processed by udev.
- fix internal bitmap allocation problems with v1.1, v1.2 metadata.
- --help now goes to stdout so you can direct it to a pager.
- Various manpage updates.
- Make "--grow --add" for linear arrays really work.
- --auto-detect to trigger in-kernel autodetect.
- Make return code for "--detail --test" more reliable. Missing
devices as well as failed devices cause an error.
Changes Prior to 2.6.1 release
- --monitor was producing some meaningless warnings due to a bug.
- Fix some compiler warnings.
- Fully support --grow for raid6. If a reshape crashed during the
critical period, mdadm wouldn't restore the Q information
properly.
- Update documentation for --grow.
Changes Prior to 2.6 release
- Fixed UUID printing in "--detail --brief" for version1 metadata.
- --update=resync did exactly the wrong thing for version1 metadata.
It caused a resync to not happen, rather than to happen.
- Allow --assemble --force to mark a raid6 clean when it has two
missing devices (which is needed else if won't assemble.
Without this fix it would only assemble if one or zero
missing devices.
- Support --update=devicesize for cases where the underlying device
can change size.
- Default to --auto=yes so the array devices with 'standard' names
get created automatically, as this is almost always what is wanted.
- Give useful message if raid4/5/6 cannot be started because it is
not clean and is also degraded.
- Increase raid456 stripe cache size if needed to --grow the array.
The setting used unfortunately requires intimate knowledge of the
kernel, and it not reset when the reshape finishes.
- Change 'Device Size' to 'Used Dev Size' because it only shows how
much of each device is actually used, not how big they are.
- --wait or -W will wait for resync activity to finish on the given
devices.
- Fix some problems with --update=uuid and add a test.
- If two drives in a raid5 disappear at the same time, then "-Af"
will add them both in rather than just one and forcing the array
to 'clean'. This is slightly safer in some cases.
- Check device is large enough before hot-add: this improves quality
of error message.
- Don't hold md device open for so long in --monitor mode - map_dev
can be slow and interferes with trying to stop the array.
- Support --uuid= with --create to choose your own UUID.
- New major more "--incremental" for incremental assemble of arrays,
intended for use with udev.
Changes Prior to 2.5.6 release
- Fix bug which meant "bitmap=xxx" in mdadm.conf was not handled
properly.
- Documentation updates.
- Fix bug that caused infinite loop when doing auto-assembly,
in certain cases where arrays couldn't be assembled.
Changes Prior to 2.5.5 release
- Don't #include linux/blkpg.h as that isn't safe. Just
include the content literally.
- Reduce maximum bitmap usage when working with bitmap files,
so that a only single-page allocations are made, even on
64bit hosts with 4K pages.
- Close stray fd in mdassemble so that it can assemble stacked
devices
- If mdassemble finds an array already assembled, it marks it
read-write.
- Remove error in md_open if array is already active. This isn't
needed and gets in the ways if an array was created e.g. in
initramfs, but device doesn't yet exist in /dev.
- When --assemble --scan is run, if all arrays that could be found
have already been started, don't report an error.
- Fix a couple of bugs related to raid10 and the new 'offset' layout.
- Improve error message when a wrong '--update' option is given.
Changes Prior to 2.5.4 release
- When creating devices in /dev/md/ create matching symlinks
from /dev. e.g. /dev/md0 -> /dev/md/0.
Allow this to be disabled in mdadm.conf or on command line.
- Fix some endian-ness issues with version-1 superblocks (affects
bigendian only).
- Fix endian problem with 'bitmap' metadata
- Allow a number (of partitions) after the 'yes' option to --auto=
This is particularly useful in the 'create' line in mdadm.conf.
- Remove partitions from any whole device that is made part of
an md array. This is a work-around for annoying messages
when the first block on some drive accidentally looks like a
partition table.
Changes Prior to 2.5.3 release
- Document v0.91 superblocks in md.4
- Make GPL explicit in man pages.
- Fix recent breakage of starting degraded arrays.
- Tidyup automatic name choice for v-1 arrays:
/dev/md_d0 now becomes '0', not '_d0'.
Changes Prior to 2.5.2 release
- Fix problem with compiling with gcc-2 compilers
- Fix compile problem of post-incrmenting a variable in a macro arg.
- Stop map_dev from returning [0:0], as that breaks things.
- Add 'Array Slot' line to --examine for version-1 superblocks
to make it a bit easier to see what is happening.
- Work around bug in --add handling for version-1 superblocks
in 2.6.17 (and prior).
- Make -assemble a bit more resilient to finding strange
information in superblocks.
- Don't claim newly added spares are InSync!! (don't know why that
code was ever in there)
- Work better when no 'ftw' is available, and check to see
if current uclibc provides ftw.
- Never use /etc/mdadm.conf if --config file is given (previously
some code used one, some used the other).
Changes Prior to 2.5.1 release
- Various fixes for gcc warnings
- uclibc warnings
- Makefile improvements for static linking/intalling
- Makefile uninstall target
- Really fix return status of --examine
- Typos
- Byteorder stuff (again)
- Don't try to create devices with --manage or --grow
- allow default metadata (superblock) type to be specified
in mdadm.conf
- Get --stop to list devices stopped but honour --quiet
- remove libssl dependency
- Avoid some misdetection of overlapping partitions
- Fix memory leak in --monitor mode
Changes Prior to 2.5 release
- Support 'mailfrom' line in mdadm.conf so the From: line in alert
emails can be explicitly set.
- Arrange that SparesMissing (which is similar in import to
DegradedArray) generates an Email.
- Assume "DEVICE partitions" if no DEVICE line is given.
- Support new 'offset' layout for raid10.
- When creating a bitmap file, choose a chunksize to limit number
of bitmap chunks to 2 million. More than this can cause kmalloc
failure.
- New 'CREATE' line in mdadm.conf for defaults such as owner, group,
mode and auto-flag
- --detail checks if array has been started or not and includes that
in report.
- When using --update=uuid on an array with a bitmap, update the
bitmap's uuid too.
- Add a copy of /proc/mdstat to the mail message sent by mdadm
--monitor.
- New flag --no-degraded to avoid starting arrays if there are
fewer devices available than last time the array was started.
This is only needed with --scan, as with --scan, that behaviour
is the default.
- Support for 'homehost' concept. This is a fairly major update.
It includes a configfile option and a command line option for
specifying a homehost, records that host in the superblock,
and reports the homehost where possible.
- Support for Auto Assembly. "mdadm -As" will, if provided with
the name of a homehost, try to assemble all arrays it can find
that were created for that homehost. See man pages for more details.
Changes Prior to 2.4.1 release
- Honour --write-mostly when adding to an array without persistent
superblocks.
- Fix alignment problem in version-1 superblocks.
NOTE: This is an incompatable change affecting raid5 reshape.
If you want to reshape a raid5 using version-1 superblocks,
use 2.6.17-rc2 or later, and mdadm-2.4.1 or later.
Changes Prior to 2.4 release
- Rewrite 'reshape' support including performing a backup
of the critical region for a raid5 growth, and restoring that
backup after a crash.
- Put a 'canary' at each end of the backup so a corruption
can be more easily detected.
- Remove useless 'ident' arguement from ->getinfo_super method.
- Support --backup-file for backing-up critical section during
growth.
- Erase old superblocks (of different versions) when creating new
array.
- Allow --monitor to work with arrays with >28 devices
- Report reshape information in --detail
- Handle symlinks in /dev better
- Fix mess in --detail output which a device is missing.
- Manpage tidyup
- Support 'bitmap=' in mdadm.conf for auto-assembling arrays with
write-intent bitmaps in separate files.
- Updates to md.4 man page including section on RESTRIPING and SYSFS
Changes Prior to 2.3.1 release
- Fixed -O2 compile so I could make and RPM.
- Type cast number to be printed %llu so it compiles on 64bit
machines. (Thanks Luca).
- Stop using asm/byteorder.h - to make Redhat happy :-(
- Require bitmap files to have a '/' in their name.
- Error-check a few syscalls - code from SuSE package.
Changes Prior to 2.3 release
- Try /etc/mdadm/mdadm.conf if /etc/mdadm.conf doesn't exist.
This provided compatability for Debian.
- Fixed for version-1 superblock:
report chunksize for raid6 and raid10
make sure device size used is a multiple of chunksize
- Fix "--assemble --scan" crash.
- Fix completely failure to create array on ppc64
- Fix memcmp in place of memcpy
- A few minor improvements to online help
- Clean up usage of 'long long' for used-size of devices, so
that it is possible to create a raid1 of 7TB devices!
- Make internal bitmaps work on 7TB raid1 arrays.
- Provide error message if --examine doesn't find any superblock.
- Report 'reshape' status in --examine - this depends on kernel
patches that are not yet finalised.
- Report bitmap status in --detail and --examine
- Default to v1 superblocks instead of v0.90 if the array
is too big for 0.90 to handle.
- Sort the output of "mdadm --detail --scan" so that it is
in a suitable order for assembling arrays. i.e. components come
before an array that they are part of.
- Print size of large reiserfs array properly went warning of
possible confilcts.
Changes Prior to 2.2 release
- Assorted bug fixes
- Support write-intent-bitmaps on raid10
- Support little-endian (Rather than hostendian) bitmaps.
- Return correct error code from 'mdadm -S'
- Remove extra blank line from 'mdadm -Eb' output.
- Improve option parsing so that -a and -b do not have
optional arguements: the arg is either required or not
depending on context.
- Allow scanning of devices listed in /proc/partitions even
if they don't appear in /dev.
- Support --assume-clean in --create mode as well as --build
- Add support for --monitor to report to syslog: -y or --syslog.
Thanks to Ross Vandegrift
- --monitor now reports which device failed in a 'Fail' message
This broke with 2.6
- Improve chance of array starting properly after a crash.
mdadm was insisting the event numbers were identical, but this
isn't needed, and is a problem if the crash was while the metadata
was being updated.
- Support --update==uuid
- Added README.initramfs and mkinitramfs to help people use an
initram for starting md arrays at boot.
Changes Prior to 2.1 release
- Fix assembling of raid10 array when devices are missing.
mdadm now correctly detects if a array is workable or not
depending on which devices are present, and so will correctly
handle "--assemble --force" if multiple devices have failed.
- Report raid10 layout in --examine output.
- Fix assembling of arrays that use the version-1 superblock and
have spares. Previously the spares would be ignored.
- Fix bug so that multiple drives can be re-added at once.
- Fix problem with hot-adding a bitmap to version-1-superblock
arrays.
Changes Prior to 2.0
- Support assembling from byte-swapped superblocks
metadata type "0.swap" and --update=byteorder
- write-mostly and write-behind support for raid1.
- Support --name= and 'name=' config entry for identifying
arrays be name.
- RAID10 in man pages.
- Lot of minor manpage updates
Changes Prior to 2.0-devel-3 release
- Assorted fixes for multiple bugs...
- Add test suite
Changes Prior to release 3.0.1
- Fix various segfaults
- Fixed for --examine with containers
- Lots of other little fixes.
Changes Prior to 1.12.0 release
Several of these are backported from the Debian package
- Don't use 'lstat' to check for blockdevices, use stat.
- Document --size=max option for --grow
- Document SparesMissing event and DeviceDisappeared/WrongLevel
- --stop --scan repeatly cycles until no more progress can be made
so that stack devices are stopped properly
- Minor type rationalisation for ident->uuid - now always 'int[]'
- Fix type in online help for --grow (was -F, now -G)
- Allow --auto command line option to set default auto=
value when running "--assemble --scan". Previously
--auto was ignored if --scan was given
- Fix a few type casts
- Fix parsing of /dev/md/N in is_standard
- Fix rounding errors in human_size()
- Fix silly example in mdadm.conf-examples
- When finding a /dev name for a device, prefer shorter names
- Suppress listing of devices= in --brief output of -D or -E,
unless -v is given (-vv gives the old behaviour with -Dsv).
This is because the device list can change and so is not a
stable aspect of the array
- Allow --force with --grow so '-Gfn1' works (on raid1)
- Replace sprintf calls with snprintf (to quiet diet-libc)
- Add man page for mdassemble
- Fix compilation with tinyc
Changes Prior to 1.11.0 release
- Fix embarassing bug which causes --add to always fail.
Changes Prior to 1.10.0 release
- Fix bug with --config=partitions
- Open sub-devices with O_EXCL to detect if already in use
- Make sure superblock updates are flushed directly to disk.
Changes Prior to 2.0-devel-1 release
- Support for version-1 superblock. See --metadata option.
- Support for bitmap based intent logging.
- Minor fixes.
Changes Prior to 1.9.0 release
- Fix rpm build problem (stray %)
- Minor manpage updates
- Change "dirty" status to "active" as it was confusing people.
- --assemble --auto recognises 'standard' name and insists on using
the appropriate major/minor number for them.
- Remove underscore from partition names, so partitions of
"foo" are "foo1", "foo2" etc (unchanged) and partitions of
"f00" are "f00p1", "f00p2" etc rather than "f00_p1"...
- Use "major", "minor", "makedev" macros instead of
"MAJOR", "MINOR", "MKDEV" so that large device numbers work
on 2.6 (providing you have glibc 2.3.3 or later).
- Add some missing closes of open file descriptors.
- Reread /proc/partition for every array assembled when using
it to find devices, rather than only once.
- Make "mdadm -Ss" stop stacked devices properly, by reversing the
order in which arrays are stopped.
- Improve some error messages.
- Allow device name to appear before first option, so e.g.
mdadm /dev/md0 -A /dev/sd[ab]
works.
- Assume '-Q' if just a device is given, rather than being silent.
- Change "dirty" status to "active" as it was confusing people.
Changes Prior to 1.8.0 release
- Makefile cleanup from Luca Berra <bluca@comedia.it>
- --pid-file (-i) to set a pid file to use with --monitor --daemonise
- Fix typo in mdadm man page
- Fix coredump when "-s" used with no config file present.
- Support new "faulty" personality which can inject synthetic
faults. (Not in kernel.org yet at 1Nov2004)
- Support raid0/linear on devices > 2 Terabytes
- Make sure raid6 resyncs when created with one missing device
Changes Prior to 1.7.0 release
- Support "--grow --add" to add a device to a linear array, if the
kernel supports it. Not documented yet.
- Restore support for uclibc which was broken recently.
- Several improvements to the output of --detail, including
reporting "resyncing" or "recovering" in the state.
- Close filedescriptor at end of --detail (exit would have closed it
anyway, so this isn't abig deal).
- Report "Sync checkpoint" in --examine output if appropriate.
- Add --update=resync for --assemble mode to for a resync when the
array is assembled.
- Add support for "raid10", which is under development in 2.6.
Not documented yet.
- --monitor now reads spare-group and spares info from config file
even when names of arrays to scan are given on the command line
Changes Prior to 1.6.0 release
- Device name given in -Eb is determined by examining /dev rather
than assuming /dev/md%d
- Fix bug in --monitor where an array could be held open an so
could not be stopped without killing mdadm.
- Add --grow mode. Currently only --size and --raid-disks can be
changed. Both require kernel support which, at the time of
writing, is not in a release kernel yet.
- Don't print out "errors" or "no-errors" in -D and -E, as the bit
is never set or used.
- Use md event notification in 2.6.??? to make --monitor mode
respond instantly to events.
- Add --auto= option and auto= configfile entry to tell mdadm to
create device files as needed. This is particularly useful
with partitioned arrays where the major device number can change.
- When generating --brief listing, if the standard name doesn't
exist, search /dev for one rather than using a temp name.
- Allow --build to build raid1 and multipath arrays.
- Add "--assume-clean" for Create and Build, particularly for raid1
Note: this is dangerous. Only use it if you are certain.
- Fix bug so that Rebuild status monitoring works again.
- Add "degraded" and "recovering" options to the "Status:"
entry for --detail
Changes Prior to 1.5.0 release
- new commands "mdassemble" which is a stripped-down equivalent of
"mdadm -As", that can be compiled with dietlibc.
Thanks to Luca Berra <bluca@comedia.it>.
It can be using in an initramfs or initrd.
- Fix compiling error with BLKGETSIZE64 and some signed/unsigned
comparison warnings.
- Add Rebuild Status (% complete) to --detail output.
- Support "--monitor --test" which will generate a test alert
for each array once, to test notification paths.
- Generate RebuildFinished event when rebuild finishes.
- Support for raid6 as found in 2.6.2 - thanks to
H. Peter Anvin <hpa@zytor.com>
- Support partitioned md arrays with a different major number and
naming scheme (md_dX in /proc/mdstat, /dev/md/dXpY in /dev).
Changes Prior to 1.4.0 release
- Document fact that creating a raid5 array really creates a
degraded array with a spare.
- Add "spares=" tag to config file and generate it wit --detail and
--examine
- Add "SparesMissing" event when --monitor first sees an array and
it doesn't have the enough spare devices.
- Add --update=summaries for --assemble to update summary
information in superblock, and correct other inconsistancies in
the superblock.
- Add --test option to --detail to set a meaningful exit status.
Changes Prior to 1.3.0 release
- Make 'size' and unsigned long in Create to allow creation of
larger arrays.
- Explicitly flag spare devices as 'spare' in --detail and --examine
output. Previously they simply had no flags lists.
- Make MailCmd (for monitor) configurable in Makefile, and default
to "/usr/sbin/sendmail -t". Also split out the warning related
flags into CWFLAGS for easier build configurability.
- Minor bugfix in Manage code.
- --monitor now notices and reports degraded arrays at startup using
"DegradedArray" event, and also has a --oneshot option to only
report DegradedArrays, and then exit.
- Small man-page clarification w.r.t. raid levels and raid4 in
particular.
- Disallow creation of arrays with only one device as this is
probably a mistake. --force will override this check.
- Correct some misleading documentation in the "mdadm --create --help"
message.
- Ignore chunksize if raid1 or multipath.
- Explicit statement in man page that raid-disks cannot be changed
after array is created.
- Improve message when attempting to start an array with
insufficient devices. Instead of required the array to be full,
we only require it has as many active devices as last time.
Changes Prior to 1.2.0 release
- Fix bug where --daemonise required an argument.
- In --assemble --verbose, print appropriate message if device is
not in devices= list
- Updated mdadm.conf.5 to reflect fact that device= takes wildcards
- Typos: componenet -> component
- Reduce size of "--help" message put excess into "--help-options"
- Fix bug introduced when MD_SB_DISKS dependancy removed, and which
caused spares not be assembled properly.
- Print appropriate message if --monitor --scan decides not to
monitor anything.
Changes Prior to 1.1.0 release
- add --deamonise flag for --monitor - forks and prints pid to stdout
- Fix bug so we REALLY clear dirty flag with -Af
- -Db now prints a 'devices=' word for each array.
- "mdadm -A /dev/md0" will get info from configfile, even without scan
- When assembling multipath arrays, ignore devices which are flagged
as having errors.
- take --super-minor=dev to mean "use the minor number of the mddev
being assembled.
- take --config=none to mean "completely ignore config file"
- Make --monitor require --scan or a device list.
Changes Prior to 1.0.9 release
- Documentation updates including kernel parameters documented
in md.4
- --assemble --force for raid4/5 will mark clean, needed for 2.5
- --detail prints out the events counter as well
- flush device before reading superblock to be sure to get
current data
- added mdadm.static target to makefile for static linking
- --monitor was ignoring /dev/md0 due to off-by-one error
- Fix assorted typos
- Fix printing of Gibibytes - calc was wrong.
- Fix printing of Array Size in --detail when very big.
- --monitor no longer tries to work for raid0 or linear as these
have nothing to be monitored.
- The word 'partitions' on a DEVICE line will cause all partitions
listed in /proc/partitions to be considered
- If the config file is called 'partitions' then it will be treated
as though it contained exactly 'device partitions' so e.g.
mdadm -Ebsc partitions
will find all raid partitions easily.
- successfully assemble multipath devices by ignoring raid_disk
value from superblock (it is always the same).
- --assemble not tied to MD_SB_DISKS limit quite so much
- Support compiling with tcc
- Support compiling with uclibc - just skip scan of /dev
- Add --update= option for Assemble mode. Either sparc2.2
or super-minor updates are possible. See mdadm.8
Changes Prior to 1.0.1 release
- Round off MB/GiB etc values instead of round down.
- Add --sparc2.2 option to examine to shift superblock around
and --sparc2.2update to rewrite the superblock
- Fix assorted typos in online help
Changes Prior to 1.0.0 release
- Allow --config with Misc mode (for --examine --scan)
- Add $(CXFLAGS) to end of CFLAGS in makefile
- When making an N disk raid5 array, the Nth drive
is moved to the end of the array as a spare rather than
being shifted up one place. This means that when the
kernel builds onto the last spare and inserts it,
the devices will be in the expected order.
- Man page improvements
Changes Prior to 0.8.2 release
- Correct spelling of persist[ae]nce/persist[ae]nt.
- Change "disk" to "device" in options and config file
- convert array size to "long long" *before* shift-left in -D and -Q
Changes Prior to 0.8.1 release
- Add "INSTALL" file.
- Fix some "i" variables that were not being set properly
- Initialise minsize and maxsize so that compilers don't complain.
- Tidy up Makefile and mdadm.spec installations
- Add "multipath" to documentation of valid levels
Changes Prior to 0.8 release
- Fix another bug in Assemble.c due to confusing 'i' with 'j'
- Minimal, untested, support for multipath
- re-write of argument parsing to have more coherent modes,
- add --query,-Q option
- Update mdadm.8 to reflect arg processing change and --query
- Change "long" to "unsigned long" for device sizes
- Handle "mailaddr" and "program" lines in config file for follow/scan mode.
- --follow --scan will exit if no program or mail found
- Add MAILADDR and PROGRAM to mdadm.conf-example
- Spell check man pages
- consistently use "component devices" instead of "subdevices"
- Make -Wall -Werror really work and fix lots of errors.
- --detail and --stop can have --scan which chooses devices from /proc/mdstat
- --monitor detects 20% changes in resync, failed spares,
disappearing arrays,
- --monitor --scan will automatically add any devices found in /proc/mdstat
- --monitor will move spares between arrays with same spare-group if necessary
- Documentation for Monitor Mode
- --query notes if the array containing the given device is active or not
- Finished md.4 man page.
Changes Prior to 0.7.2 release
- mdadm.spec updates and ifdef BLKGETSIZE64 from Luca Berra -- bluca@comedia.it
- more mdadm.spec updates from Gregory Leblanc <gleblanc@linuxweasel.com>
- make directory for mdadm.conf configurable in Makefile
- Finished mdadm.conf.5. Removed details of conf file from
mdadm.8 leaving a reference to mdadm.conf.5.
- Fix bug in Assemble.c, thanks to Junaid Rizvi <domdev@sat.net.pk>
- Get --assemble --force to make sure old major/minor numbers are
consistant, as md.c worries about this :-(
Changes Prior to 0.7.1 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
Also install man page.
- Add --zero-superblock based on --destroywithextremeprejudice
from Dale Stephenson <steph@snapserver.com>
- change name to mdadm. It is palandromic, and much nicer to pronouce.
Changes Prior to 0.6 release
- Remove the limit on the number of device names that can be
given on the command line.
- Fix bug in --assemble --force where it would only update a
single superblock.
- Fix bogus printing of big numbers not being block devices
when given names of devices that don't exist.
- When --assemble --force, consider superblocks with an event
count that is 1 behind as out-of-date. Normally they are
considered up-to-date (as the kernel assumes this too).
- When marking drives as not-failed in the superblock,
we also mark them as ACTIVE and SYNC.
- Don't start arrays for which not all drives are available unless:
--scan which implies that all drives were found automatically
--run which means the user knows what they want
--force which means that we are fixing something broken
- Make sure all device numbers passed as 3rd arg of ioctl
are passed as unsigned lock, so that it works on SPARC
- If HOT_ADD_DISK failes for -a, then only try ADD_NEW_DISK
if we cannot read from the array, i.e. if the array is
not started yet.
- man page update
- Taught Examine to handle --scan. It examines all devices listed
on DEVICE lines in the config file.
- Added --brief (-b) flag for Examine and Detail to print out
and mdctl.conf compatible description with uuid=, level=,
disks= and - for Examine - devices=
--examine --brief collects all devices the make the one array and
list them as one entry.
- Added level= and disks= options to ARRAY lines in config files
so --brief output could be used as-is.
- Make parity style ({left,right}-{,a}symmetric) consistantly use -,
never _.
- Add "Array Size" to --detail output
- Change "Size" to "Device Size" and exclude from Detail of arrays
that do not have a consistent device size.
- Add Human readable MiB or GiB value on size lines of Detail and Examine
- --assemble --scan doesn't complain about active drives
- require number of spares given in -x to be listed.
- Made --build actually work.
Changes Prior to 0.5 release
--assemble:
spare drives are handled properly.
--force can be used to recover from 2-drive failures on RAID5
If you belive that /dev/hda1 /dev/hdb1 /dev/hdc1 /dev/hdd1 should
make a raid5 array, but it has experienced multiple failures and
wont start, then
mdctl --assemble --force /dev/md0 /dev/hd[abcd]1
Should update the superblock on the newest failed drive and
restart the array in degraded mode. You should then remove the
remaining failed drive and re-add it (if you are happy that it
might work).
Ofcourse whenever you have a 2-drive failure, you have a risk
of corruption in data that hasn't be changed for a long time. So
this doesn't give you your array back all nice and happy, but it
does allow you to recover data that might not be corrupt.
More flexibility in identifying a RAID array in the mdctl.conf
e.g.
array /dev/md4 super-minor=4
assembles /dev/md4 from all devices found that have a raid
superblock that says the minor number of the array is 4.
If the blocks with the right minor number do not all have the
same UUID, an error is flags and no assembly happens.
array /dev/md3 devices=/dev/hd[abc]2
Assembles /dev/md3 drom /dev/hda2 /dev/hdb2 and/dev/hdc2. All
devices must exist and have raid superblock with the same uuid.
If two identity specifiers are used, only devices that match all
of them are considered, so
array /dev/md2 devices=/dev/hd?2 super-minor=2
will assemble /dev/md2 using all /dev/hd?2 devices which have a
raid superblock with minor number 2.
--create:
When listing devices for --create, the word "missing" can be
used to indicate that the respective slot does not have a
working drive currently. This is similar to the "failed-disk"
directive in mkraid/raidtab.
e.g.
mdctl --create --level=5 -raid-disks=4 --spare-disks=2
/dev/md0 /dev/sda /dev/sdb missing /dev/sdc /dev/sdd /dev/sde
will create a raid5 array with the third slot empty, and two
spares.
By default, raid5 arrays are created with the last slot empty
and drive listed for the last slot added as a spare. If a
"missing" slot is given, or if --force is given, then --create
does exactly what you ask and doesn't try to be clever.
--follow / --monitor:
This is a new mode. I couldn't stop my self from picking a name
starting with F (as current modes start A,B,C,D,E) but I
relented and provided an alternate name that is somewhat more
meaningful.
In this mode, mdctl does not exit, but runs continuously and
periodically polls all the md devices to see if they have had
any interested state change.
The changes that it currently notices are:
Fail - an active disc fails
FailSpare - a spare, that was presumably being build, fails
ActiveSpare - a spare becomes active, presumably after a rebuild.
Options:
--mail mailaddress - send Email on any Fail* event
--program program - run the program on any event.
Args are: eventname mddevice subdevice(if-known)
--delay seconds - change from the default 60second pause
between polls.
I plan to add functionality to this mode to allow sharing of
spare drives. If an array is marks "spare-group=fred", and it
has a failed drive and no spares, and if some other array is
also "spare-group=fred" and it has no failed drives, but does
have a spare drive that is big enough, the spare will be moved
to the first array.
I also have the idea of adding a --grow mode which will re-organise
the data on an N disk raid0/4/5 array to be on an N+M disk array.
I have no concrete plans for this though.
I got rid of the "v" in the archive file name, and include the
version number in the directory created by the archive.
There is now a man page and mdctl.spec (for rpm) thanks to
Danilo Godec <danci@agenda.si>.
Ofcourse, the man page is now out of date and despite being based on
the --help output, is not wholy correct. After I get --follow
working properly, I plan to revise the various documentation and/or
the code to make sure the two match.
Changes Prior to release 3.0
- Support for externally managed metadata, specifically DDF and IMSM.
- Depend on udev to create entries in /dev, rather than creating them
ourselves.
- remove --auto-update-home-hosts
- new config file line "auto"
- new "<ignore>" and "any" options for "homehost"
- numerous bug fixes and minor enhancements.

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -797,7 +792,39 @@ int Create(struct supertype *st, char *mddev,
dv == moved_disk && dnum != insert_point) break;
}
if (pass == 1) {
struct mdinfo info_new;
struct map_ent *me = NULL;
/* check to see if the uuid has changed due to these
* metadata changes, and if so update the member array
* and container uuid. Note ->write_init_super clears
* the subarray cursor such that ->getinfo_super once
* again returns container info.
*/
map_lock(&map);
st->ss->getinfo_super(st, &info_new);
if (st->ss->external && level != LEVEL_CONTAINER &&
!same_uuid(info_new.uuid, info.uuid, 0)) {
map_update(&map, fd2devnum(mdfd),
info_new.text_version,
info_new.uuid, chosen_name);
me = map_by_devnum(&map, st->container_dev);
}
st->ss->write_init_super(st);
/* update parent container uuid */
if (me) {
char *path = strdup(me->path);
st->ss->getinfo_super(st, &info_new);
map_update(&map, st->container_dev,
info_new.text_version,
info_new.uuid, path);
free(path);
}
map_unlock(&map);
flush_metadata_updates(st);
}
}

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -127,12 +122,25 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
disk.minor == 0)
continue;
if ((dv=map_dev(disk.major, disk.minor, 1))) {
if ((!st || !st->sb) &&
/* some formats (imsm) have free-floating-spares
* with a uuid of uuid_match_any, they don't
* have very good info about the rest of the
* container, so keep searching when
* encountering such a device. Otherwise, stop
* after the first successful call to
* ->load_super.
*/
int free_spare = memcmp(uuid_match_any,
info.uuid,
sizeof(uuid_match_any)) == 0;
if ((!st || !st->sb || free_spare) &&
(array.raid_disks == 0 ||
(disk.state & (1<<MD_DISK_ACTIVE)))) {
/* try to read the superblock from this device
* to get more info
*/
if (free_spare)
st->ss->free_super(st);
int fd2 = dev_open(dv, O_RDONLY);
if (fd2 >=0 && st &&
st->ss->load_super(st, fd2, NULL) == 0) {
@ -199,11 +207,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
printf("ARRAY %s", dev);
if (brief > 1) {
if (array.raid_disks)
printf("level=%s num-devices=%d",
printf(" level=%s num-devices=%d",
c?c:"-unknown-",
array.raid_disks );
else
printf("level=container num-devices=%d",
printf(" level=container num-devices=%d",
array.nr_disks);
}
if (container) {

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -68,7 +63,7 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
} *arrays = NULL;
for (; devlist ; devlist=devlist->next) {
struct supertype *st = forcest;
struct supertype *st;
fd = dev_open(devlist->devname, O_RDONLY);
if (fd < 0) {
@ -80,7 +75,9 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
err = 1;
}
else {
if (!st)
if (forcest)
st = dup_super(forcest);
else
st = guess_super(fd);
if (st)
err = st->ss->load_super(st, fd,
@ -119,11 +116,10 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
ap->st = st;
arrays = ap;
st->ss->getinfo_super(st, &ap->info);
} else {
} else
st->ss->getinfo_super(st, &ap->info);
st->ss->free_super(st);
}
if (!(ap->info.disk.state & (1<<MD_DISK_SYNC)))
if (!st->loaded_container &&
!(ap->info.disk.state & (1<<MD_DISK_SYNC)))
ap->spares++;
d = dl_strdup(devlist->devname);
dl_add(ap->devs, d);
@ -141,15 +137,23 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
for (ap=arrays; ap; ap=ap->next) {
char sep='=';
char *d;
int newline = 0;
ap->st->ss->brief_examine_super(ap->st, brief > 1);
if (ap->spares) printf(" spares=%d", ap->spares);
if (ap->spares)
newline += printf(" spares=%d", ap->spares);
if (brief > 1) {
printf(" devices");
newline += printf(" devices");
for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
printf("%c%s", sep, d);
sep=',';
}
}
if (ap->st->ss->brief_examine_subarrays) {
if (newline)
printf("\n");
ap->st->ss->brief_examine_subarrays(ap->st, brief > 1);
}
ap->st->ss->free_super(ap->st);
/* FIXME free ap */
if (ap->spares || brief > 1)

9
Grow.c
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
#include "dlink.h"

View File

@ -2,7 +2,7 @@
* Incremental.c - support --incremental. Part of:
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2006-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify

9
Kill.c
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*
* Added by Dale Stephenson
* steph@snapserver.com

View File

@ -88,7 +88,7 @@ SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \
MON_OBJS = mdmon.o monitor.o managemon.o util.o mdstat.o sysfs.o config.o \
Kill.o sg_io.o dlink.o ReadMe.o super0.o super1.o super-intel.o \
super-ddf.o sha1.o crc32.o msg.o Monitor.o bitmap.o \
super-ddf.o sha1.o crc32.o msg.o bitmap.o \
platform-intel.o probe_roms.o
@ -105,7 +105,7 @@ ASSEMBLE_SRCS += $(ASSEMBLE_AUTO_SRCS)
ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
endif
all : mdadm mdmon mdadm.man md.man mdadm.conf.man
all : mdadm mdmon mdadm.man md.man mdadm.conf.man mdmon.man
everything: all mdadm.static swap_super test_stripe \
mdassemble mdassemble.auto mdassemble.static mdassemble.man \
@ -167,6 +167,9 @@ mdassemble.klibc : $(ASSEMBLE_SRCS) mdadm.h
mdadm.man : mdadm.8
nroff -man mdadm.8 > mdadm.man
mdmon.man : mdmon.8
nroff -man mdmon.8 > mdmon.man
md.man : md.4
nroff -man md.4 > md.man
@ -198,8 +201,9 @@ install-uclibc : mdadm.uclibc install-man
install-klibc : mdadm.klibc install-man
$(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm
install-man: mdadm.8 md.4 mdadm.conf.5
install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
$(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
$(INSTALL) -D -m 644 mdmon.8 $(DESTDIR)$(MAN8DIR)/mdmon.8
$(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
@ -207,7 +211,7 @@ install-udev: udev-md-raid.rules
$(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules
uninstall:
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 md.4 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm
test: mdadm mdmon test_stripe swap_super
@echo "Please run 'sh ./test' as root"

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -428,11 +423,15 @@ int Manage_subdevs(char *devname, int fd,
} else {
j = 0;
if (stat(dv->devname, &stb)) {
tfd = dev_open(dv->devname, O_RDONLY);
if (tfd < 0 || fstat(tfd, &stb) != 0) {
fprintf(stderr, Name ": cannot find %s: %s\n",
dv->devname, strerror(errno));
if (tfd >= 0)
close(tfd);
return 1;
}
close(tfd);
if ((stb.st_mode & S_IFMT) != S_IFBLK) {
fprintf(stderr, Name ": %s is not a "
"block device.\n",
@ -454,7 +453,7 @@ int Manage_subdevs(char *devname, int fd,
return 1;
}
/* Make sure it isn't in use (in 2.6 or later) */
tfd = open(dv->devname, O_RDONLY|O_EXCL|O_DIRECT);
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL|O_DIRECT);
if (tfd < 0) {
fprintf(stderr, Name ": Cannot open %s: %s\n",
dv->devname, strerror(errno));
@ -610,7 +609,7 @@ int Manage_subdevs(char *devname, int fd,
int dfd;
if (dv->writemostly == 1)
disc.state |= 1 << MD_DISK_WRITEMOSTLY;
dfd = open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
if (tst->ss->add_to_super(tst, &disc, dfd,
dv->devname)) {
close(dfd);

138
Monitor.c
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -284,6 +279,10 @@ int Monitor(mddev_dev_t devlist,
mse = mse2;
}
if (array.utime == 0)
/* external arrays don't update utime */
array.utime = time(0);
if (st->utime == array.utime &&
st->failed == array.failed_disks &&
st->working == array.working_disks &&
@ -481,16 +480,25 @@ int Monitor(mddev_dev_t devlist,
}
}
if (dev > 0) {
if (ioctl(fd2, HOT_REMOVE_DISK,
(unsigned long)dev) == 0) {
if (ioctl(fd1, HOT_ADD_DISK,
(unsigned long)dev) == 0) {
struct mddev_dev_s devlist;
char devname[20];
devlist.next = NULL;
devlist.used = 0;
devlist.re_add = 0;
devlist.writemostly = 0;
devlist.devname = devname;
sprintf(devname, "%d:%d", major(dev), minor(dev));
devlist.disposition = 'r';
if (Manage_subdevs(st2->devname, fd2, &devlist, -1) == 0) {
devlist.disposition = 'a';
if (Manage_subdevs(st->devname, fd1, &devlist, -1) == 0) {
alert("MoveSpare", st->devname, st2->devname, mailaddr, mailfrom, alert_cmd, dosyslog);
close(fd1);
close(fd2);
break;
}
else ioctl(fd2, HOT_ADD_DISK, (unsigned long) dev);
else Manage_subdevs(st2->devname, fd2, &devlist, -1);
}
}
close(fd1);
@ -573,7 +581,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
n=fwrite(buf, 1, n, mp); /* yes, i don't care about the result */
fclose(mdstat);
}
fclose(mp);
pclose(mp);
}
}
@ -641,107 +649,3 @@ int Wait(char *dev)
mdstat_wait(5);
}
}
static char *clean_states[] = {
"clear", "inactive", "readonly", "read-auto", "clean", NULL };
int WaitClean(char *dev, int verbose)
{
int fd;
struct mdinfo *mdi;
int rv = 1;
int devnum;
fd = open(dev, O_RDONLY);
if (fd < 0) {
if (verbose)
fprintf(stderr, Name ": Couldn't open %s: %s\n", dev, strerror(errno));
return 1;
}
devnum = fd2devnum(fd);
mdi = sysfs_read(fd, devnum, GET_VERSION|GET_LEVEL|GET_SAFEMODE);
if (!mdi) {
if (verbose)
fprintf(stderr, Name ": Failed to read sysfs attributes for "
"%s\n", dev);
close(fd);
return 0;
}
switch(mdi->array.level) {
case LEVEL_LINEAR:
case LEVEL_MULTIPATH:
case 0:
/* safemode delay is irrelevant for these levels */
rv = 0;
}
/* for internal metadata the kernel handles the final clean
* transition, containers can never be dirty
*/
if (!is_subarray(mdi->text_version))
rv = 0;
/* safemode disabled ? */
if (mdi->safe_mode_delay == 0)
rv = 0;
if (rv) {
int state_fd = sysfs_open(fd2devnum(fd), NULL, "array_state");
char buf[20];
fd_set fds;
struct timeval tm;
/* minimize the safe_mode_delay and prepare to wait up to 5s
* for writes to quiesce
*/
sysfs_set_safemode(mdi, 1);
tm.tv_sec = 5;
tm.tv_usec = 0;
/* give mdmon a chance to checkpoint resync */
sysfs_set_str(mdi, NULL, "sync_action", "idle");
FD_ZERO(&fds);
/* wait for array_state to be clean */
while (1) {
rv = read(state_fd, buf, sizeof(buf));
if (rv < 0)
break;
if (sysfs_match_word(buf, clean_states) <= 4)
break;
FD_SET(state_fd, &fds);
rv = select(state_fd + 1, NULL, NULL, &fds, &tm);
if (rv < 0 && errno != EINTR)
break;
lseek(state_fd, 0, SEEK_SET);
}
if (rv < 0)
rv = 1;
else if (ping_monitor(mdi->text_version) == 0) {
/* we need to ping to close the window between array
* state transitioning to clean and the metadata being
* marked clean
*/
rv = 0;
} else
rv = 1;
if (rv && verbose)
fprintf(stderr, Name ": Error waiting for %s to be clean\n",
dev);
/* restore the original safe_mode_delay */
sysfs_set_safemode(mdi, mdi->safe_mode_delay);
close(state_fd);
}
sysfs_free(mdi);
close(fd);
return rv;
}

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2002-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2002-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2007 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -24,7 +24,7 @@
#include "mdadm.h"
char Version[] = Name " - v3.0-rc1 - 11th May 2009\n";
char Version[] = Name " - v3.0.2 - 25th September 2009\n";
/*
* File: ReadMe.c
@ -139,7 +139,9 @@ struct option long_options[] = {
{"write-mostly",0, 0, 'W'},
{"re-add", 0, 0, ReAdd},
{"homehost", 1, 0, HomeHost},
#if 0
{"auto-update-homehost", 0, 0, AutoHomeHost},
#endif
{"symlinks", 1, 0, Symlinks},
/* For assemble */

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"

View File

@ -1,33 +1,7 @@
ANNOUNCE-2.0
ANNOUNCE-2.1
ANNOUNCE-2.2
ANNOUNCE-2.3
ANNOUNCE-2.3.1
ANNOUNCE-2.4
ANNOUNCE-2.4.1
ANNOUNCE-2.4-pre1
ANNOUNCE-2.5
ANNOUNCE-2.5.1
ANNOUNCE-2.5.2
ANNOUNCE-2.5.3
ANNOUNCE-2.5.4
ANNOUNCE-2.5.5
ANNOUNCE-2.5.6
ANNOUNCE-2.6
ANNOUNCE-2.6.1
ANNOUNCE-2.6.2
ANNOUNCE-2.6.3
ANNOUNCE-2.6.4
ANNOUNCE-2.6.5
ANNOUNCE-2.6.6
ANNOUNCE-2.6.7
ANNOUNCE-2.6.8
ANNOUNCE-2.6.9
ANNOUNCE-3.0-devel1
ANNOUNCE-3.0-devel2
ANNOUNCE-3.0-devel3
ANNOUNCE-3.0-rc1
ANNOUNCE-3.0
ANNOUNCE-3.0.1
ANNOUNCE-3.0.2
Assemble.c
bitmap.c
bitmap.h

View File

@ -1,8 +1,8 @@
/*
* mdmon - monitor external metadata arrays
*
* Copyright (C) 2007-2008 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2008 Intel Corporation
* Copyright (C) 2007-2009 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View File

@ -297,6 +297,37 @@ struct map_ent *map_by_name(struct map_ent **map, char *name)
return NULL;
}
/* sets the proper subarray and container_dev according to the metadata
* version super_by_fd does this automatically, this routine is meant as
* a supplement for guess_super()
*/
static void set_member_info(struct supertype *st, struct mdstat_ent *ent)
{
st->subarray[0] = '\0';
if (ent->metadata_version == NULL ||
strncmp(ent->metadata_version, "external:", 9) != 0)
return;
if (is_subarray(&ent->metadata_version[9])) {
char version[strlen(ent->metadata_version)+1];
char *subarray;
char *name = &version[10];
strcpy(version, ent->metadata_version);
subarray = strrchr(version, '/');
name = &version[10];
if (!subarray)
return;
*subarray++ = '\0';
st->container_dev = devname2devnum(name);
strncpy(st->subarray, subarray, sizeof(st->subarray));
}
}
void RebuildMap(void)
{
struct mdstat_ent *mdstat = mdstat_read(0, 0);
@ -337,8 +368,10 @@ void RebuildMap(void)
st = guess_super(dfd);
if ( st == NULL)
ok = -1;
else
else {
set_member_info(st, md);
ok = st->ss->load_super(st, dfd, NULL);
}
close(dfd);
if (ok != 0)
continue;

80
md.4
View File

@ -11,6 +11,8 @@ md \- Multiple Device driver aka Linux Software RAID
.BI /dev/md n
.br
.BI /dev/md/ n
.br
.BR /dev/md/ name
.SH DESCRIPTION
The
.B md
@ -37,15 +39,17 @@ including RAID0 (striped array), LINEAR (catenated array),
MULTIPATH (a set of different interfaces to the same device),
and FAULTY (a layer over a single device into which errors can be injected).
.SS MD SUPER BLOCK
Each device in an array may have a
.I superblock
which records information about the structure and state of the array.
.SS MD METADATA
Each device in an array may have some
.I metadata
stored in the device. This metadata is sometimes called a
.BR superblock .
The metadata records information about the structure and state of the array.
This allows the array to be reliably re-assembled after a shutdown.
From Linux kernel version 2.6.10,
.B md
provides support for two different formats of this superblock, and
provides support for two different formats of metadata, and
other formats can be added. Prior to this release, only one format is
supported.
@ -66,11 +70,11 @@ normally 1K long, but can be longer. It is normally stored between 8K
and 12K from the end of the device, on a 4K boundary, though
variations can be stored at the start of the device (version 1.1) or 4K from
the start of the device (version 1.2).
This superblock format stores multibyte data in a
This metadata format stores multibyte data in a
processor-independent format and supports up to hundreds of
component devices (version 0.90 only supports 28).
The superblock contains, among other things:
The metadata contains, among other things:
.TP
LEVEL
The manner in which the devices are arranged into the array
@ -80,6 +84,7 @@ UUID
a 128 bit Universally Unique Identifier that identifies the array that
contains this device.
.PP
When a version 0.90 array is being reshaped (e.g. adding extra devices
to a RAID5), the version number is temporarily set to 0.91. This
ensures that if the reshape process is stopped in the middle (e.g. by
@ -88,7 +93,7 @@ not support reshaping, then the array will not be assembled (which
would cause data corruption) but will be left untouched until a kernel
that can complete the reshape processes is used.
.SS ARRAYS WITHOUT SUPERBLOCKS
.SS ARRAYS WITHOUT METADATA
While it is usually best to create arrays with superblocks so that
they can be assembled reliably, there are some circumstances when an
array without superblocks is preferred. These include:
@ -118,6 +123,40 @@ configuration that does not use a superblock, and to maintain the state of
the array elsewhere. While not encouraged for general us, it does
have special-purpose uses and is supported.
.SS ARRAYS WITH EXTERNAL METADATA
From release 2.6.28, the
.I md
driver supports arrays with externally managed metadata. That is,
the metadata is not managed by the kernel by rather by a user-space
program which is external to the kernel. This allows support for a
variety of metadata formats without cluttering the kernel with lots of
details.
.PP
.I md
is able to communicate with the user-space program through various
sysfs attributes so that it can make appropriate changes to the
metadata \- for example to make a device as faulty. When necessary,
.I md
will wait for the program to acknowledge the event by writing to a
sysfs attribute.
The manual page for
.IR mdmon (8)
contains more detail about this interaction.
.SS CONTAINERS
Many metadata formats use a single block of metadata to describe a
number of different arrays which all use the same set of devices.
In this case it is helpful for the kernel to know about the full set
of devices as a whole. This set is known to md as a
.IR container .
A container is an
.I md
array with externally managed metadata and with device offset and size
so that it just covers the metadata part of the devices. The
remainder of each device is available to be incorporated into various
arrays.
.SS LINEAR
A linear array simply catenates the available space on each
@ -138,12 +177,12 @@ A RAID0 array (which has zero redundancy) is also known as a
striped array.
A RAID0 array is configured at creation with a
.B "Chunk Size"
which must be a power of two, and at least 4 kibibytes.
which must be a power of two (prior to Linux 2.6.31), and at least 4
kibibytes.
The RAID0 driver assigns the first chunk of the array to the first
device, the second chunk to the second device, and so on until all
drives have been assigned one chunk. This collection of chunks forms
a
drives have been assigned one chunk. This collection of chunks forms a
.BR stripe .
Further chunks are gathered into stripes in the same way, and are
assigned to the remaining space in the drives.
@ -175,6 +214,11 @@ multiple sequential streams or a random workload will use more than one
spindle. In theory, having an N-disk RAID1 will allow N sequential
threads to read from all disks.
Individual devices in a RAID1 can be marked as "write-mostly".
This drives are excluded from the normal read balancing and will only
be read from when there is no other option. This can be useful for
devices connected over a slow link.
.SS RAID4
A RAID4 array is like a RAID0 array with an extra device for storing
@ -274,7 +318,11 @@ A MULTIPATH array is composed of a number of logically different
devices, often fibre channel interfaces, that all refer the the same
real device. If one of these interfaces fails (e.g. due to cable
problems), the multipath driver will attempt to redirect requests to
another interface.
another interface.
The MULTIPATH drive is not receiving any ongoing development and
should be considered a legacy driver. The device-mapper based
multipath drivers should be preferred for new installations.
.SS FAULTY
The FAULTY md module is provided for testing purposes. A faulty array
@ -569,6 +617,8 @@ in
.TP
.B md_mod.start_ro=1
.TP
.B /sys/module/md_mod/parameters/start_ro
This tells md to start all arrays in read-only mode. This is a soft
read-only that will automatically switch to read-write on the first
write request. However until that write request, nothing is written
@ -577,6 +627,8 @@ operation is started.
.TP
.B md_mod.start_dirty_degraded=1
.TP
.B /sys/module/md_mod/parameters/start_dirty_degraded
As mentioned above, md will not normally start a RAID4, RAID5, or
RAID6 that is both dirty and degraded as this situation can imply
hidden data loss. This can be awkward if the root filesystem is
@ -626,13 +678,13 @@ 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 disks will shuffle
more data for a given speed). The default is 100.
more data for a given speed). The default is 1000.
.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.
The default is 200,000.
.SH SEE ALSO
.BR mdadm (8),

526
mdadm.8

File diff suppressed because it is too large Load Diff

25
mdadm.c
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*
* Additions for bitmap and write-behind RAID options, Copyright (C) 2003-2004,
* Paul Clements, SteelEye Technology, Inc.
@ -345,9 +340,11 @@ int main(int argc, char *argv[])
}
continue;
#if 0
case O(ASSEMBLE,AutoHomeHost):
auto_update_home = 1;
continue;
#endif
case O(INCREMENTAL, 'e'):
case O(CREATE,'e'):
case O(ASSEMBLE,'e'):
@ -433,7 +430,10 @@ int main(int argc, char *argv[])
optarg);
exit(2);
}
if (level != 0 && level != -1 && level != 1 && level != -4 && level != -5 && mode == BUILD) {
if (level != 0 && level != LEVEL_LINEAR && level != 1 &&
level != LEVEL_MULTIPATH && level != LEVEL_FAULTY &&
level != 10 &&
mode == BUILD) {
fprintf(stderr, Name ": Raid level %s not permitted with --build.\n",
optarg);
exit(2);
@ -1166,6 +1166,7 @@ int main(int argc, char *argv[])
} while (rv2!=2);
/* Incase there are stacked devices, we need to go around again */
} while (acnt);
#if 0
if (cnt == 0 && auto_update_home && homehost) {
/* Nothing found, maybe we need to bootstrap homehost info */
do {
@ -1185,6 +1186,7 @@ int main(int argc, char *argv[])
/* Incase there are stacked devices, we need to go around again */
} while (acnt);
}
#endif
if (cnt == 0 && rv == 0) {
fprintf(stderr, Name ": No arrays found in config file or automatically\n");
rv = 1;
@ -1382,6 +1384,13 @@ int main(int argc, char *argv[])
rv = 1;
break;
}
if (delay == 0) {
if (get_linux_version() > 20616)
/* mdstat responds to poll */
delay = 1000;
else
delay = 60;
}
rv= Monitor(devlist, mailaddr, program,
delay?delay:60, daemonise, scan, oneshot,
dosyslog, test, pidfile);

View File

@ -63,7 +63,7 @@ will cause
.I mdadm
to look for assembled CONTAINER arrays and included them as a source
for assembling further arrays.
.PP
The word
.I partitions
will cause
@ -86,7 +86,7 @@ DEVICE /dev/hda* /dev/hdc*
.br
DEV /dev/sd*
.br
DEVICE /dev/discs/disc*/disc
DEVICE /dev/disk/by-path/pci*
.br
DEVICE partitions
@ -109,13 +109,12 @@ which matches the rest of the line will never be automatically assembled.
If no device name is given,
.I mdadm
will use various heuristics to determine an appropriate name.
.PP
Subsequent words identify the array, or identify the array as a member
of a group. If multiple identities are given,
then a component device must match ALL identities to be considered a
match. Each identity word has a tag, and equals sign, and some value.
The tags are:
.RS 4
.TP
.B uuid=
@ -160,6 +159,7 @@ this is mainly for compatibility with the output of
.TP
.B spares=
The value is a number of spare devices to expect the array to have.
The sole use of this keyword and value is as follows:
.B mdadm \-\-monitor
will report an array if it is found to have fewer than this number of
spares when
@ -225,12 +225,12 @@ Specify that this array is a member array of some container. The
value given can be either a path name in /dev, or a UUID of the
container array.
.IP
.TP
.B member=
Specify that this array is a member array of some container. Each
type of container has some way to enumerate member arrays, often a
simple sequence number. The value identifies which member of a
container the array is. It will usually accompany a 'container=' word.
container the array is. It will usually accompany a "container=" word.
.RE
.TP
@ -337,7 +337,7 @@ The
.B homehost
line gives a default value for the
.B --homehost=
option to mdadm. There should be exactly one other word on the line.
option to mdadm. There should normally be only one other word on the line.
It should either be a host name, or one of the special words
.B <system>
and
@ -351,19 +351,26 @@ systemcall is used to get the host name.
If
.B <ignore>
is given, then a flag is set so that when arrays are being
auto-assemble the checking of the recorded
auto-assembled the checking of the recorded
.I homehost
is disabled.
If
.B <ignore>
is given it is also possible to give an explicit name which will be
used when creating arrays. This is the only case when there can be
more that one other word on the
.B HOMEHOST
line.
When arrays are created, this host name will be stored in the
metadata. When arrays are assembled using auto-assembly, arrays which
do not record the correct homehost name in their metadata will be
assembled using a 'foreign' name. A 'foreign' name alway ends with a
digit string (possibly preceded by an underscore) to differentiate it
assembled using a "foreign" name. A "foreign" name alway ends with a
digit string preceded by an underscore to differentiate it
from any possible local name. e.g.
.B /dev/md/1_1
or
.BR /dev/md/home0 .
.BR /dev/md/home_0 .
.TP
.B AUTO
A list of names of metadata format can be given, each preceded by a

11
mdadm.h
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#define _GNU_SOURCE
@ -446,6 +441,7 @@ extern struct superswitch {
*/
void (*examine_super)(struct supertype *st, char *homehost);
void (*brief_examine_super)(struct supertype *st, int verbose);
void (*brief_examine_subarrays)(struct supertype *st, int verbose);
void (*export_examine_super)(struct supertype *st);
/* Used to report details of an active array.
@ -861,6 +857,7 @@ extern int open_container(int fd);
extern int mdmon_running(int devnum);
extern int signal_mdmon(int devnum);
extern int check_env(char *name);
extern __u32 random32(void);
extern int start_mdmon(int devnum);
extern char *devnum2devname(int num);

View File

@ -1,6 +1,6 @@
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
Name: mdadm
Version: 3.0_rc1
Version: 3.0.2
Release: 1
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tgz
URL: http://neil.brown.name/blog/mdadm

View File

@ -1,5 +1,5 @@
.\" -*- nroff -*-
.TH MDASSEMBLE 8 "" v3.0-rc1
.TH MDASSEMBLE 8 "" v3.0.2
.SH NAME
mdassemble \- assemble MD devices
.I aka

View File

@ -1,7 +1,7 @@
/*
* mdassemble - assemble Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
* Copyright (C) 2003 Luca Berra <bluca@vodka.it>
*
*
@ -20,12 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"

70
mdmon.8
View File

@ -1,5 +1,5 @@
.\" See file COPYING in distribution for details.
.TH MDMON 8 "" v3.0-rc1
.TH MDMON 8 "" v3.0.2
.SH NAME
mdmon \- monitor MD external metadata arrays
@ -15,11 +15,12 @@ occurs, like disk failures and clean-to-dirty transitions. The kernel, in
important cases, waits for user space to take action on these notifications.
.SH DESCRIPTION
.P
.B Metadata updates:
.P
To service metadata update requests a daemon, mdmon, is introduced.
Mdmon is tasked with polling the sysfs namespace looking for changes in
.SS Metadata updates:
To service metadata update requests a daemon,
.IR mdmon ,
is introduced.
.I Mdmon
is tasked with polling the sysfs namespace looking for changes in
.BR array_state ,
.BR sync_action ,
and per disk
@ -48,7 +49,9 @@ The safe mode timer has expired so set array state to clean to block writes to t
Clear the dirty bit for the volume
.TP
.B array_state \- read-only
This is the initial state that all arrays start at. mdmon takes one of the three actions:
This is the initial state that all arrays start at.
.I mdmon
takes one of the three actions:
.RS
.TP
1/
@ -72,8 +75,8 @@ checkpoint resync.
.TP
.B sync_action \- recover\-to\-idle
A spare may have completed rebuilding so tell the metadata handler about the
state of each disk. This is the metadata handlers opportunity to clear any
"out-of-sync" bits and clear the volumes degraded status. If a recovery
state of each disk. This is the metadata handler's opportunity to clear
any "out-of-sync" bits and clear the volume's degraded status. If a recovery
process is idled before it completes this event allows the metadata handler to
checkpoint recovery.
.TP
@ -81,10 +84,10 @@ checkpoint recovery.
A disk failure kicks off a series of events. First, notify the metadata
handler that a disk has failed, and then notify the kernel that it can unblock
writes that were dependent on this disk. After unblocking the kernel this disk
is set to be removed* from the member array. Finally the disk is marked failed
is set to be removed+ from the member array. Finally the disk is marked failed
in all other member arrays in the container.
.IP
\* Note This behavior differs slightly from native MD arrays where
+ Note This behavior differs slightly from native MD arrays where
removal is reserved for a
.B mdadm --remove
event. In the external metadata case the container holds the final
@ -93,8 +96,7 @@ reference on a block device and a
call is still required.
.RE
.P
.B Containers:
.SS Containers:
.P
External metadata formats, like DDF, differ from the native MD metadata
formats in that they define a set of disks and a series of sub-arrays
@ -106,7 +108,9 @@ each array can created be created with a subset of those partitions. The
supported external formats perform this disk carving internally.
.P
Container devices simply hold references to all member disks and allow
tools like mdmon to determine which active arrays belong to which
tools like
.I mdmon
to determine which active arrays belong to which
container. Some array management commands like disk removal and disk
add are now only valid at the container level. Attempts to perform
these actions on member arrays are blocked with error messages like:
@ -125,14 +129,36 @@ CONTAINER
The
.B container
device to monitor. It can be a full path like /dev/md/container, a simple md
device name like md127, or /proc/mdstat which tells mdmon to scan for
containers and launch an mdmon instance for each one found.
device name like md127, or /proc/mdstat which tells
.I mdmon
to scan for containers and launch an
.I mdmon
instance for each one found.
.TP
[NEWROOT]
In order to support an external metadata raid array as the rootfs mdmon needs
to be started in the initramfs environment. Once the initramfs environment
mounts the final rootfs mdmon needs to be restarted in the new namespace. When
NEWROOT is specified mdmon will terminate any mdmon instances that are running
in the current namespace, chroot(2) to NEWROOT, and continue monitoring the
container.
In order to support an external metadata raid array as the rootfs
.I mdmon
needs to be started in the initramfs environment. Once the initramfs
environment mounts the final rootfs
.I mdmon
needs to be restarted in the new namespace. When NEWROOT is specified
.I mdmon
will terminate any
.I mdmon
instances that are running in the current namespace,
.IR chroot (2)
to NEWROOT, and continue monitoring the container.
.PP
Note that
.I mdmon
is automatically started by
.I mdadm
when needed and so does not need to be considered when working with
RAID arrays. The only times it is run other that by
.I mdadm
is when the boot scripts need to restart it after mounting the new
root filesystem.
.SH SEE ALSO
.IR mdadm (8),
.IR md (4).

View File

@ -1,8 +1,8 @@
/*
* mdmon - monitor external metadata arrays
*
* Copyright (C) 2007-2008 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2008 Intel Corporation
* Copyright (C) 2007-2009 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -395,7 +395,7 @@ int mdmon(char *devname, int devnum, int scan, char *switchroot)
} else
pfd[0] = pfd[1] = -1;
container = malloc(sizeof(*container));
container = calloc(1, sizeof(*container));
container->devnum = devnum;
container->devname = devname;
container->arrays = NULL;

View File

@ -1,8 +1,8 @@
/*
* mdmon - monitor external metadata arrays
*
* Copyright (C) 2007-2008 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2008 Intel Corporation
* Copyright (C) 2007-2009 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"

View File

@ -2,7 +2,7 @@
* mdstat - parse /proc/mdstat file. Part of:
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2002-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2002-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -20,12 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
/*

View File

@ -1,8 +1,8 @@
/*
* mdmon - monitor external metadata arrays
*
* Copyright (C) 2007-2008 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2008 Intel Corporation
* Copyright (C) 2007-2009 Neil Brown <neilb@suse.de>
* Copyright (C) 2007-2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View File

@ -90,7 +90,7 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver)
list->path = canonicalize_file_name(path);
list->next = NULL;
}
closedir(driver_dir);
return head;
}
@ -157,6 +157,7 @@ static int scan(const void *start, const void *end)
const struct imsm_orom *find_imsm_orom(void)
{
static int populated = 0;
unsigned long align;
/* it's static data so we only need to read it once */
if (populated)
@ -184,7 +185,11 @@ const struct imsm_orom *find_imsm_orom(void)
return NULL;
/* scan option-rom memory looking for an imsm signature */
if (probe_roms_init() != 0)
if (check_env("IMSM_SAFE_OROM_SCAN"))
align = 2048;
else
align = 512;
if (probe_roms_init(align) != 0)
return NULL;
probe_roms();
populated = scan_adapter_roms(scan);

View File

@ -32,6 +32,8 @@ static void *rom_mem = MAP_FAILED;
static int rom_fd = -1;
const static int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */
static int _sigbus;
static unsigned long rom_align;
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
static void sigbus(int sig)
@ -76,11 +78,20 @@ void probe_roms_exit(void)
}
}
int probe_roms_init(void)
int probe_roms_init(unsigned long align)
{
int fd;
int rc = 0;
/* valid values are 2048 and 512. 512 is for PCI-3.0 compliant
* systems, or systems that do not have dangerous/legacy ISA
* devices. 2048 should always be safe
*/
if (align == 512 || align == 2048)
rom_align = align;
else
return -1;
if (signal(SIGBUS, sigbus) == SIG_ERR)
rc = -1;
if (rc == 0) {
@ -208,6 +219,11 @@ int scan_adapter_roms(scan_fn fn)
return found;
}
static unsigned long align(unsigned long addr, unsigned long alignment)
{
return (addr + alignment - 1) & ~(alignment - 1);
}
void probe_roms(void)
{
const void *rom;
@ -220,7 +236,7 @@ void probe_roms(void)
/* video rom */
upper = adapter_rom_resources[0].start;
for (start = video_rom_resource.start; start < upper; start += 2048) {
for (start = video_rom_resource.start; start < upper; start += rom_align) {
rom = isa_bus_to_virt(start);
if (!romsignature(rom))
continue;
@ -239,7 +255,7 @@ void probe_roms(void)
break;
}
start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
start = align(video_rom_resource.end + 1, rom_align);
if (start < upper)
start = upper;
@ -255,7 +271,7 @@ void probe_roms(void)
}
/* check for adapter roms on 2k boundaries */
for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += rom_align) {
rom = isa_bus_to_virt(start);
if (!romsignature(rom))
continue;
@ -273,7 +289,7 @@ void probe_roms(void)
adapter_rom_resources[i].start = start;
adapter_rom_resources[i].end = start + length - 1;
start = adapter_rom_resources[i++].end & ~2047UL;
start = adapter_rom_resources[i++].end & ~(rom_align - 1);
}
}

View File

@ -18,7 +18,7 @@
*/
void probe_roms_exit(void);
int probe_roms_init(void);
int probe_roms_init(unsigned long align);
typedef int (*scan_fn)(const void *start, const void *end);
int scan_adapter_roms(scan_fn fn);
void probe_roms(void);

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2006-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2006-2007 Neil Brown <neilb@suse.de>
* Copyright (C) 2006-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -762,6 +762,9 @@ static int load_ddf_local(int fd, struct ddf_super *super,
static int load_super_ddf_all(struct supertype *st, int fd,
void **sbp, char *devname, int keep_fd);
#endif
static void free_super_ddf(struct supertype *st);
static int load_super_ddf(struct supertype *st, int fd,
char *devname)
{
@ -798,6 +801,8 @@ static int load_super_ddf(struct supertype *st, int fd,
return 1;
}
free_super_ddf(st);
if (posix_memalign((void**)&super, 512, sizeof(*super))!= 0) {
fprintf(stderr, Name ": malloc of %zu failed.\n",
sizeof(*super));
@ -835,6 +840,18 @@ static int load_super_ddf(struct supertype *st, int fd,
return rv;
}
if (st->subarray[0]) {
struct vcl *v;
for (v = super->conflist; v; v = v->next)
if (v->vcnum == atoi(st->subarray))
super->currentconf = v;
if (!super->currentconf) {
free(super);
return 1;
}
}
/* Should possibly check the sections .... */
st->sb = super;
@ -1163,6 +1180,18 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info);
static void uuid_from_super_ddf(struct supertype *st, int uuid[4]);
static void brief_examine_super_ddf(struct supertype *st, int verbose)
{
/* We just write a generic DDF ARRAY entry
*/
struct mdinfo info;
char nbuf[64];
getinfo_super_ddf(st, &info);
fname_from_uuid(st, &info, nbuf, ':');
printf("ARRAY metadata=ddf UUID=%s\n", nbuf + 5);
}
static void brief_examine_subarrays_ddf(struct supertype *st, int verbose)
{
/* We just write a generic DDF ARRAY entry
*/
@ -1172,7 +1201,6 @@ static void brief_examine_super_ddf(struct supertype *st, int verbose)
char nbuf[64];
getinfo_super_ddf(st, &info);
fname_from_uuid(st, &info, nbuf, ':');
printf("ARRAY metadata=ddf UUID=%s\n", nbuf + 5);
for (i=0; i<__be16_to_cpu(ddf->virt->max_vdes); i++) {
struct virtual_entry *ve = &ddf->virt->entries[i];
@ -1495,17 +1523,6 @@ static int update_super_ddf(struct supertype *st, struct mdinfo *info,
return rv;
}
__u32 random32(void)
{
__u32 rv;
int rfd = open("/dev/urandom", O_RDONLY);
if (rfd < 0 || read(rfd, &rv, 4) != 4)
rv = random();
if (rfd >= 0)
close(rfd);
return rv;
}
static void make_header_guid(char *guid)
{
__u32 stamp;
@ -2345,15 +2362,19 @@ static int __write_init_super_ddf(struct supertype *st, int do_close)
static int write_init_super_ddf(struct supertype *st)
{
struct ddf_super *ddf = st->sb;
struct vcl *currentconf = ddf->currentconf;
/* we are done with currentconf reset it to point st at the container */
ddf->currentconf = NULL;
if (st->update_tail) {
/* queue the virtual_disk and vd_config as metadata updates */
struct virtual_disk *vd;
struct vd_config *vc;
struct ddf_super *ddf = st->sb;
int len;
if (!ddf->currentconf) {
if (!currentconf) {
int len = (sizeof(struct phys_disk) +
sizeof(struct phys_disk_entry));
@ -2372,14 +2393,14 @@ static int write_init_super_ddf(struct supertype *st)
len = sizeof(struct virtual_disk) + sizeof(struct virtual_entry);
vd = malloc(len);
*vd = *ddf->virt;
vd->entries[0] = ddf->virt->entries[ddf->currentconf->vcnum];
vd->populated_vdes = __cpu_to_be16(ddf->currentconf->vcnum);
vd->entries[0] = ddf->virt->entries[currentconf->vcnum];
vd->populated_vdes = __cpu_to_be16(currentconf->vcnum);
append_metadata_update(st, vd, len);
/* Then the vd_config */
len = ddf->conf_rec_len * 512;
vc = malloc(len);
memcpy(vc, &ddf->currentconf->conf, len);
memcpy(vc, &currentconf->conf, len);
append_metadata_update(st, vc, len);
/* FIXME I need to close the fds! */
@ -3587,6 +3608,7 @@ struct superswitch super_ddf = {
#ifndef MDASSEMBLE
.examine_super = examine_super_ddf,
.brief_examine_super = brief_examine_super_ddf,
.brief_examine_subarrays = brief_examine_subarrays_ddf,
.export_examine_super = export_examine_super_ddf,
.detail_super = detail_super_ddf,
.brief_detail_super = brief_detail_super_ddf,

View File

@ -64,7 +64,6 @@ struct imsm_disk {
#define SPARE_DISK __cpu_to_le32(0x01) /* Spare */
#define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */
#define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */
#define USABLE_DISK __cpu_to_le32(0x08) /* Fully usable unless FAILED_DISK is set */
__u32 status; /* 0xF0 - 0xF3 */
__u32 owner_cfg_num; /* which config 0,1,2... owns this disk */
#define IMSM_DISK_FILLERS 4
@ -247,6 +246,7 @@ struct intel_super {
int creating_imsm; /* flag to indicate container creation */
int current_vol; /* index of raid device undergoing creation */
__u32 create_offset; /* common start for 'current_vol' */
__u32 random; /* random data for seeding new family numbers */
struct intel_dev *devlist;
struct dl {
struct dl *next;
@ -686,10 +686,9 @@ static void print_imsm_disk(struct imsm_super *mpb, int index, __u32 reserved)
snprintf(str, MAX_RAID_SERIAL_LEN + 1, "%s", disk->serial);
printf(" Disk%02d Serial : %s\n", index, str);
s = disk->status;
printf(" State :%s%s%s%s\n", s&SPARE_DISK ? " spare" : "",
printf(" State :%s%s%s\n", s&SPARE_DISK ? " spare" : "",
s&CONFIGURED_DISK ? " active" : "",
s&FAILED_DISK ? " failed" : "",
s&USABLE_DISK ? " usable" : "");
s&FAILED_DISK ? " failed" : "");
printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id));
sz = __le32_to_cpu(disk->total_blocks) - reserved;
printf(" Usable Size : %llu%s\n", (unsigned long long)sz,
@ -714,6 +713,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
printf(" Magic : %s\n", str);
snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb));
printf(" Version : %s\n", get_imsm_version(mpb));
printf(" Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num));
printf(" Family : %08x\n", __le32_to_cpu(mpb->family_num));
printf(" Generation : %08x\n", __le32_to_cpu(mpb->generation_num));
getinfo_super_imsm(st, &info);
@ -755,6 +755,23 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
}
static void brief_examine_super_imsm(struct supertype *st, int verbose)
{
/* We just write a generic IMSM ARRAY entry */
struct mdinfo info;
char nbuf[64];
struct intel_super *super = st->sb;
if (!super->anchor->num_raid_devs) {
printf("ARRAY metadata=imsm\n");
return;
}
getinfo_super_imsm(st, &info);
fname_from_uuid(st, &info, nbuf, ':');
printf("ARRAY metadata=imsm UUID=%s\n", nbuf + 5);
}
static void brief_examine_subarrays_imsm(struct supertype *st, int verbose)
{
/* We just write a generic IMSM ARRAY entry */
struct mdinfo info;
@ -768,15 +785,13 @@ static void brief_examine_super_imsm(struct supertype *st, int verbose)
getinfo_super_imsm(st, &info);
fname_from_uuid(st, &info, nbuf, ':');
printf("ARRAY metadata=imsm auto=md UUID=%s\n", nbuf + 5);
for (i = 0; i < super->anchor->num_raid_devs; i++) {
struct imsm_dev *dev = get_imsm_dev(super, i);
super->current_vol = i;
getinfo_super_imsm(st, &info);
fname_from_uuid(st, &info, nbuf1, ':');
printf("ARRAY /dev/md/%.16s container=%s\n"
" member=%d auto=mdp UUID=%s\n",
printf("ARRAY /dev/md/%.16s container=%s member=%d UUID=%s\n",
dev->volume, nbuf + 5, i, nbuf1 + 5);
}
}
@ -1090,7 +1105,7 @@ static int match_home_imsm(struct supertype *st, char *homehost)
/* the imsm metadata format does not specify any host
* identification information. We return -1 since we can never
* confirm nor deny whether a given array is "meant" for this
* host. We rely on compare_super and the 'family_num' field to
* host. We rely on compare_super and the 'family_num' fields to
* exclude member disks that do not belong, and we rely on
* mdadm.conf to specify the arrays that should be assembled.
* Auto-assembly may still pick up "foreign" arrays.
@ -1118,7 +1133,7 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4])
*/
/* imsm does not track uuid's so we synthesis one using sha1 on
* - The signature (Which is constant for all imsm array, but no matter)
* - the family_num of the container
* - the orig_family_num of the container
* - the index number of the volume
* - the 'serial' number of the volume.
* Hopefully these are all constant.
@ -1128,10 +1143,18 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4])
char buf[20];
struct sha1_ctx ctx;
struct imsm_dev *dev = NULL;
__u32 family_num;
/* some mdadm versions failed to set ->orig_family_num, in which
* case fall back to ->family_num. orig_family_num will be
* fixed up with the first metadata update.
*/
family_num = super->anchor->orig_family_num;
if (family_num == 0)
family_num = super->anchor->family_num;
sha1_init_ctx(&ctx);
sha1_process_bytes(super->anchor->sig, MPB_SIG_LEN, &ctx);
sha1_process_bytes(&super->anchor->family_num, sizeof(__u32), &ctx);
sha1_process_bytes(&family_num, sizeof(__u32), &ctx);
if (super->current_vol >= 0)
dev = get_imsm_dev(super, super->current_vol);
if (dev) {
@ -1257,7 +1280,11 @@ static void fixup_container_spare_uuid(struct mdinfo *inf)
struct supertype *_cst; /* container supertype */
_cst = array_list->st;
_sst = _cst->ss->match_metadata_desc(inf->text_version);
if (_cst)
_sst = _cst->ss->match_metadata_desc(inf->text_version);
else
_sst = NULL;
if (_sst) {
memcpy(inf->uuid, array_list->uuid, sizeof(int[4]));
free(_sst);
@ -1439,7 +1466,8 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
*/
if (first->anchor->num_raid_devs > 0 &&
sec->anchor->num_raid_devs > 0) {
if (first->anchor->family_num != sec->anchor->family_num)
if (first->anchor->orig_family_num != sec->anchor->orig_family_num ||
first->anchor->family_num != sec->anchor->family_num)
return 3;
}
@ -1469,17 +1497,17 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
dv->next = first->devlist;
first->devlist = dv;
}
if (i <= sec->anchor->num_raid_devs) {
if (i < sec->anchor->num_raid_devs) {
/* allocation failure */
free_devlist(first);
fprintf(stderr, "imsm: failed to associate spare\n");
return 3;
}
first->anchor->num_raid_devs = sec->anchor->num_raid_devs;
first->anchor->orig_family_num = sec->anchor->orig_family_num;
first->anchor->family_num = sec->anchor->family_num;
for (i = 0; i < sec->anchor->num_raid_devs; i++)
imsm_copy_dev(get_imsm_dev(first, i), get_imsm_dev(sec, i));
first->anchor->num_raid_devs = sec->anchor->num_raid_devs;
first->anchor->family_num = sec->anchor->family_num;
}
return 0;
@ -2168,8 +2196,10 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
if (st->subarray[0]) {
if (atoi(st->subarray) <= super->anchor->num_raid_devs)
super->current_vol = atoi(st->subarray);
else
else {
free_imsm(super);
return 1;
}
}
*sbp = super;
@ -2194,8 +2224,8 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
if (load_super_imsm_all(st, fd, &st->sb, devname, 1) == 0)
return 0;
#endif
if (st->subarray[0])
return 1; /* FIXME */
free_super_imsm(st);
super = alloc_super(0);
if (!super) {
@ -2216,6 +2246,15 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
return rv;
}
if (st->subarray[0]) {
if (atoi(st->subarray) <= super->anchor->num_raid_devs)
super->current_vol = atoi(st->subarray);
else {
free_imsm(super);
return 1;
}
}
st->sb = super;
if (st->ss == NULL) {
st->ss = &super_imsm;
@ -2405,13 +2444,16 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
"in a raid1 volume\n");
return 0;
}
map->raid_level = info->level;
if (info->level == 10) {
map->raid_level = 1;
map->num_domains = info->raid_disks / 2;
} else {
map->raid_level = info->level;
} else if (info->level == 1)
map->num_domains = info->raid_disks;
else
map->num_domains = 1;
}
num_data_stripes = info_to_num_data_stripes(info, map->num_domains);
map->num_data_stripes = __cpu_to_le32(num_data_stripes);
@ -2524,7 +2566,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
super->anchor->num_disks++;
}
set_imsm_ord_tbl_ent(map, dk->number, dl->index);
dl->disk.status = CONFIGURED_DISK | USABLE_DISK;
dl->disk.status = CONFIGURED_DISK;
/* if we are creating the first raid device update the family number */
if (super->current_vol == 0) {
@ -2534,8 +2576,10 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
*_dev = *dev;
*_disk = dl->disk;
sum = __gen_imsm_checksum(mpb);
sum = random32();
sum += __gen_imsm_checksum(mpb);
mpb->family_num = __cpu_to_le32(sum);
mpb->orig_family_num = mpb->family_num;
}
return 0;
@ -2590,7 +2634,7 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
size /= 512;
serialcpy(dd->disk.serial, dd->serial);
dd->disk.total_blocks = __cpu_to_le32(size);
dd->disk.status = USABLE_DISK | SPARE_DISK;
dd->disk.status = SPARE_DISK;
if (sysfs_disk_to_scsi_id(fd, &id) == 0)
dd->disk.scsi_id = __cpu_to_le32(id);
else
@ -2632,6 +2676,7 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose)
mpb->disk[0] = d->disk;
sum = __gen_imsm_checksum(mpb);
mpb->family_num = __cpu_to_le32(sum);
mpb->orig_family_num = 0;
sum = __gen_imsm_checksum(mpb);
mpb->check_sum = __cpu_to_le32(sum);
@ -2666,6 +2711,12 @@ static int write_super_imsm(struct intel_super *super, int doclose)
generation++;
mpb->generation_num = __cpu_to_le32(generation);
/* fix up cases where previous mdadm releases failed to set
* orig_family_num
*/
if (mpb->orig_family_num == 0)
mpb->orig_family_num = mpb->family_num;
mpb_size += sizeof(struct imsm_disk) * mpb->num_disks;
for (d = super->disks; d; d = d->next) {
if (d->index == -1)
@ -2709,17 +2760,16 @@ static int write_super_imsm(struct intel_super *super, int doclose)
}
static int create_array(struct supertype *st)
static int create_array(struct supertype *st, int dev_idx)
{
size_t len;
struct imsm_update_create_array *u;
struct intel_super *super = st->sb;
struct imsm_dev *dev = get_imsm_dev(super, super->current_vol);
struct imsm_dev *dev = get_imsm_dev(super, dev_idx);
struct imsm_map *map = get_imsm_map(dev, 0);
struct disk_info *inf;
struct imsm_disk *disk;
int i;
int idx;
len = sizeof(*u) - sizeof(*dev) + sizeof_imsm_dev(dev, 0) +
sizeof(*inf) * map->num_members;
@ -2731,11 +2781,12 @@ static int create_array(struct supertype *st)
}
u->type = update_create_array;
u->dev_idx = super->current_vol;
u->dev_idx = dev_idx;
imsm_copy_dev(&u->dev, dev);
inf = get_disk_info(u);
for (i = 0; i < map->num_members; i++) {
idx = get_imsm_disk_idx(dev, i);
int idx = get_imsm_disk_idx(dev, i);
disk = get_imsm_disk(super, idx);
serialcpy(inf[i].serial, disk->serial);
}
@ -2769,21 +2820,26 @@ static int _add_disk(struct supertype *st)
static int write_init_super_imsm(struct supertype *st)
{
struct intel_super *super = st->sb;
int current_vol = super->current_vol;
/* we are done with current_vol reset it to point st at the container */
super->current_vol = -1;
if (st->update_tail) {
/* queue the recently created array / added disk
* as a metadata update */
struct intel_super *super = st->sb;
struct dl *d;
int rv;
/* determine if we are creating a volume or adding a disk */
if (super->current_vol < 0) {
if (current_vol < 0) {
/* in the add disk case we are running in mdmon
* context, so don't close fd's
*/
return _add_disk(st);
} else
rv = create_array(st);
rv = create_array(st, current_vol);
for (d = super->disks; d ; d = d->next) {
close(d->fd);
@ -3404,8 +3460,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
s = d ? d->disk.status : 0;
if (s & FAILED_DISK)
skip = 1;
if (!(s & USABLE_DISK))
skip = 1;
if (ord & IMSM_ORD_REBUILD)
skip = 1;
@ -3626,8 +3680,9 @@ static int mark_failure(struct imsm_dev *dev, struct imsm_disk *disk, int idx)
return 0;
disk->status |= FAILED_DISK;
disk->status &= ~CONFIGURED_DISK;
set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD);
if (map->failed_disk_num == ~0)
if (~map->failed_disk_num == 0)
map->failed_disk_num = slot;
return 1;
}
@ -3838,14 +3893,13 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
int idx = get_imsm_disk_idx(dev, slot);
struct imsm_super *mpb = super->anchor;
struct imsm_map *map;
unsigned long long esize;
unsigned long long pos;
struct mdinfo *d;
struct extent *ex;
int i, j;
int found;
__u32 array_start;
__u32 blocks;
__u32 array_end;
struct dl *dl;
for (dl = super->disks; dl; dl = dl->next) {
@ -3897,15 +3951,14 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
j = 0;
pos = 0;
array_start = __le32_to_cpu(map->pba_of_lba0);
blocks = __le32_to_cpu(map->blocks_per_member);
array_end = array_start +
__le32_to_cpu(map->blocks_per_member) - 1;
do {
/* check that we can start at pba_of_lba0 with
* blocks_per_member of space
*/
esize = ex[j].start - pos;
if (array_start >= pos &&
array_start + blocks < ex[j].start) {
if (array_start >= pos && array_end < ex[j].start) {
found = 1;
break;
}
@ -3919,9 +3972,8 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
free(ex);
if (i < mpb->num_raid_devs) {
dprintf("%x:%x does not have %u at %u\n",
dl->major, dl->minor,
blocks, array_start);
dprintf("%x:%x does not have %u to %u available\n",
dl->major, dl->minor, array_start, array_end);
/* No room */
continue;
}
@ -4023,6 +4075,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
di->data_offset = __le32_to_cpu(map->pba_of_lba0);
di->component_size = a->info.component_size;
di->container_member = inst;
super->random = random32();
di->next = rv;
rv = di;
num_spares++;
@ -4189,6 +4242,15 @@ static void imsm_process_update(struct supertype *st,
set_imsm_ord_tbl_ent(map, u->slot, dl->index);
set_imsm_ord_tbl_ent(migr_map, u->slot, dl->index | IMSM_ORD_REBUILD);
/* update the family_num to mark a new container
* generation, being careful to record the existing
* family_num in orig_family_num to clean up after
* earlier mdadm versions that neglected to set it.
*/
if (mpb->orig_family_num == 0)
mpb->orig_family_num = mpb->family_num;
mpb->family_num += super->random;
/* count arrays using the victim in the metadata */
found = 0;
for (a = st->arrays; a ; a = a->next) {
@ -4502,6 +4564,7 @@ struct superswitch super_imsm = {
#ifndef MDASSEMBLE
.examine_super = examine_super_imsm,
.brief_examine_super = brief_examine_super_imsm,
.brief_examine_subarrays = brief_examine_subarrays_imsm,
.export_examine_super = export_examine_super_imsm,
.detail_super = detail_super_imsm,
.brief_detail_super = brief_detail_super_imsm,

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#define HAVE_STDINT_H 1
@ -318,9 +313,13 @@ static int match_home0(struct supertype *st, char *homehost)
{
mdp_super_t *sb = st->sb;
char buf[20];
char *hash = sha1_buffer(homehost,
strlen(homehost),
buf);
char *hash;
if (!homehost)
return 0;
hash = sha1_buffer(homehost,
strlen(homehost),
buf);
return (memcmp(&sb->set_uuid2, hash, 8)==0);
}

View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -698,6 +693,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
__u32 r[4] = {random(), random(), random(), random()};
memcpy(sb->device_uuid, r, 16);
}
if (rfd >= 0)
close(rfd);
sb->dev_roles[i] =
__cpu_to_le16(info->disk.raid_disk);

107
sysfs.c
View File

@ -2,7 +2,7 @@
* sysfs - extract md related information from sysfs. Part of:
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2006-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -786,3 +786,108 @@ int sysfs_unique_holder(int devnum, long rdev)
else
return found;
}
#ifndef MDASSEMBLE
static char *clean_states[] = {
"clear", "inactive", "readonly", "read-auto", "clean", NULL };
int WaitClean(char *dev, int verbose)
{
int fd;
struct mdinfo *mdi;
int rv = 1;
int devnum;
fd = open(dev, O_RDONLY);
if (fd < 0) {
if (verbose)
fprintf(stderr, Name ": Couldn't open %s: %s\n", dev, strerror(errno));
return 1;
}
devnum = fd2devnum(fd);
mdi = sysfs_read(fd, devnum, GET_VERSION|GET_LEVEL|GET_SAFEMODE);
if (!mdi) {
if (verbose)
fprintf(stderr, Name ": Failed to read sysfs attributes for "
"%s\n", dev);
close(fd);
return 0;
}
switch(mdi->array.level) {
case LEVEL_LINEAR:
case LEVEL_MULTIPATH:
case 0:
/* safemode delay is irrelevant for these levels */
rv = 0;
}
/* for internal metadata the kernel handles the final clean
* transition, containers can never be dirty
*/
if (!is_subarray(mdi->text_version))
rv = 0;
/* safemode disabled ? */
if (mdi->safe_mode_delay == 0)
rv = 0;
if (rv) {
int state_fd = sysfs_open(fd2devnum(fd), NULL, "array_state");
char buf[20];
fd_set fds;
struct timeval tm;
/* minimize the safe_mode_delay and prepare to wait up to 5s
* for writes to quiesce
*/
sysfs_set_safemode(mdi, 1);
tm.tv_sec = 5;
tm.tv_usec = 0;
/* give mdmon a chance to checkpoint resync */
sysfs_set_str(mdi, NULL, "sync_action", "idle");
FD_ZERO(&fds);
/* wait for array_state to be clean */
while (1) {
rv = read(state_fd, buf, sizeof(buf));
if (rv < 0)
break;
if (sysfs_match_word(buf, clean_states) <= 4)
break;
FD_SET(state_fd, &fds);
rv = select(state_fd + 1, NULL, NULL, &fds, &tm);
if (rv < 0 && errno != EINTR)
break;
lseek(state_fd, 0, SEEK_SET);
}
if (rv < 0)
rv = 1;
else if (ping_monitor(mdi->text_version) == 0) {
/* we need to ping to close the window between array
* state transitioning to clean and the metadata being
* marked clean
*/
rv = 0;
} else
rv = 1;
if (rv && verbose)
fprintf(stderr, Name ": Error waiting for %s to be clean\n",
dev);
/* restore the original safe_mode_delay */
sysfs_set_safemode(mdi, mdi->safe_mode_delay);
close(state_fd);
}
sysfs_free(mdi);
close(fd);
return rv;
}
#endif /* MDASSEMBLE */

View File

@ -27,6 +27,7 @@ do
# test save
dd if=/dev/urandom of=$md0 bs=1024 count=$size
blockdev --flushbufs $md0 $devs
> /tmp/NewRand
$dir/test_stripe save /tmp/NewRand $disks $[chunk*1024] 5 $nlayout 0 $[size*1024] $devs
cmp -s -n $[size*1024] $md0 /tmp/NewRand || { echo cmp failed ; exit 2; }

22
util.c
View File

@ -1,7 +1,7 @@
/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
* Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
* Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
* Email: <neilb@cse.unsw.edu.au>
* Paper: Neil Brown
* School of Computer Science and Engineering
* The University of New South Wales
* Sydney, 2052
* Australia
* Email: <neilb@suse.de>
*/
#include "mdadm.h"
@ -933,6 +928,8 @@ void wait_for(char *dev, int fd)
return;
usleep(200000);
}
if (i == 25)
dprintf("%s: timeout waiting for %s\n", __func__, dev);
}
struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL };
@ -1368,6 +1365,17 @@ int check_env(char *name)
return 0;
}
__u32 random32(void)
{
__u32 rv;
int rfd = open("/dev/urandom", O_RDONLY);
if (rfd < 0 || read(rfd, &rv, 4) != 4)
rv = random();
if (rfd >= 0)
close(rfd);
return rv;
}
#ifndef MDASSEMBLE
int flush_metadata_updates(struct supertype *st)
{