diff options
-rw-r--r-- | ANNOUNCE-2.5 | 67 | ||||
-rw-r--r-- | Assemble.c | 9 | ||||
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ReadMe.c | 2 | ||||
-rw-r--r-- | inventory | 5 | ||||
-rw-r--r-- | mdadm.8 | 106 | ||||
-rw-r--r-- | mdadm.c | 2 | ||||
-rw-r--r-- | mdadm.conf.5 | 2 | ||||
-rw-r--r-- | mdadm.spec | 2 | ||||
-rw-r--r-- | mdassemble.8 | 2 | ||||
-rw-r--r-- | super1.c | 2 | ||||
-rw-r--r-- | test | 4 | ||||
-rw-r--r-- | tests/05r1-internalbitmap | 1 | ||||
-rw-r--r-- | tests/05r1-n3-bitmapfile | 1 |
14 files changed, 203 insertions, 11 deletions
diff --git a/ANNOUNCE-2.5 b/ANNOUNCE-2.5 new file mode 100644 index 0000000..8515015 --- /dev/null +++ b/ANNOUNCE-2.5 @@ -0,0 +1,67 @@ +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 + @@ -28,6 +28,7 @@ */ #include "mdadm.h" +#include <ctype.h> static int name_matches(char *found, char *required, char *homehost) { @@ -112,7 +113,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, */ int must_close = 0; int old_linux = 0; - int vers; + int vers = 0; /* Keep gcc quite - it really is initialised */ void *first_super = NULL, *super = NULL; struct { char *devname; @@ -376,7 +377,11 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, st->ss->getinfo_super(&info, first_super); c = strchr(info.name, ':'); if (c) c++; else c= info.name; - asprintf(&mddev, "/dev/md/%s", c); + if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6)) + /* /dev/md/d0 style for partitionable */ + asprintf(&mddev, "/dev/md/d%s", c); + else + asprintf(&mddev, "/dev/md/%s", c); mdfd = open_mddev(mddev, ident->autof); if (mdfd < 0) return mdfd; @@ -14,12 +14,19 @@ Changes Prior to this release 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 send by mdadm + - 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 @@ -29,7 +29,7 @@ #include "mdadm.h" -char Version[] = Name " - v2.4.1 - 4 April 2006\n"; +char Version[] = Name " - v2.5 - 26 May 2006\n"; /* * File: ReadMe.c @@ -7,6 +7,7 @@ ANNOUNCE-2.3.1 ANNOUNCE-2.4 ANNOUNCE-2.4-pre1 ANNOUNCE-2.4.1 +ANNOUNCE-2.5 Assemble.c Build.c COPYING @@ -23,6 +24,7 @@ Monitor.c Query.c README.initramfs ReadMe.c +SHA1.c TODO bitmap.c bitmap.h @@ -32,6 +34,7 @@ dlink.h inventory makedist md.4 +md5.h md_p.h md_u.h mdadm.8 @@ -49,6 +52,8 @@ misc/syslog-events mkinitramfs raid5extend.c restripe.c +sha1.c +sha1.h super0.c super1.c swap_super.c @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH MDADM 8 "" v2.4.1 +.TH MDADM 8 "" v2.5 .SH NAME mdadm \- manage MD devices .I aka @@ -281,6 +281,26 @@ on the device, either at the end (for 1.0), at the start (for 1.1) or 4K from the start (for 1.2). .RE +.TP +.B --homehost= +This will over-ride any +.B HOMEHOST +setting in the config file and provides the identify of the host which +should be considered the home for any arrays. + +When creating an array, the +.B homehost +will be recorded in the superblock. For version-1 superblocks, it will +be prefixed to the array name. For version-0.90 superblocks part of +the SHA1 hash of the hostname will be stored in the later half of the +UUID. + +When reporting information about an array, any array which is tagged +for the given homehost will be reported as such. + +When using Auto-Assemble, only arrays tagged for the given homehost +will be assembled. + .SH For create, build, or grow: .TP @@ -597,7 +617,7 @@ will look for super blocks with a minor number of 0. Specify the name of the array to assemble. This must be the name that was specified when creating the array. It must either match then name stored in the superblock exactly, or it must match -which the current +with the current .I homehost is added to the start of the given name. @@ -728,6 +748,14 @@ The option will correct the summaries in the superblock. That is the counts of total, working, active, failed, and spare devices. +.TP +.B --auto-update-homehost +This flag is only meaning with auto-assembly (see discussion below). +In that situation, if no suitable arrays are found for this homehost, +.I mdadm +will recan for any arrays at all and will assemble them and update the +homehost to match the current host. + .SH For Manage mode: .TP @@ -1015,6 +1043,62 @@ option is also available in Build and Create modes. As those modes do not use a config file, the "auto=" config option does not apply to these modes. +.SS Auto Assembly +When +.B --assemble +is used with +.B --scan +and no devices are listed, +.I mdadm +will first attempt to assemble all the arrays listed in the config +file. + +If a +.B homehost +has been specified (either in the config file or on the command line), +.I mdadm +will look further for possible arrays and will try to assemble +anything that it finds which is tagged as belonging to the given +homehost. This is the only situation where +.I mdadm +will assemble arrays without being given specific device name or +identify information for the array. + +If +.I mdadm +finds a consistent set of devices that look like they should comprise +an array, and if the superblock is tagged as belonging to the given +home host, it will automatically choose a device name and try to +assemble the array. If the array uses version-0.90 metadata, then the +.B minor +number as recorded in the superblock is used to create a name in +.B /dev/md/ +so for example +.BR /dev/md/3 . +If the array uses version-1 metadata, then the +.B name +from the superblock is used to similarly create a name in +.BR /dev/md . +The name will have any 'host' prefix stripped first. + +If +.I mdadm +cannot find any array for the given host at all, and if +.B --auto-update-homehost +is given, then +.I mdadm +will search again for any array (not just an array created for this +host) and will assemble each assuming +.IR --update=homehost . +This will change the host tag in the superblock so that on the next run, +these arrays will be found without the second pass. The intention of +this feature is to support transitioning a set of md arrays to using +homehost tagging. + +The reason for requiring arrays to be tagged with the homehost for +auto assembly is to guard against problems that can arise when moving +devices from one host to another. + .SH BUILD MODE .HP 12 @@ -1089,6 +1173,24 @@ be over-ridden with the .I --force option. +When creating an array with version-1 metadata a name for the host is +required. +If this is not given with the +.B --name +option, +.I mdadm +will chose a name based on the last component of the name of the +device being created. So if +.B /dev/md3 +is being created, then the name +.B 3 +will be chosen. +If +.B /dev/md/home +is being created, then the name +.B home +will be used. + '''If the '''.B --size '''option is given, it is not necessary to list any component-devices in this command. @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) case 'a': case 'r': case 'f': - case 6: /* re-add */ + case ReAdd: /* re-add */ if (!mode) { newmode = MANAGE; shortopt = short_bitmap_auto_options; diff --git a/mdadm.conf.5 b/mdadm.conf.5 index b7d915e..b9beffa 100644 --- a/mdadm.conf.5 +++ b/mdadm.conf.5 @@ -291,6 +291,8 @@ MAILADDR root@mydomain.tld PROGRAM /usr/sbin/handle-mdadm-events .br CREATE group=system mode=0640 auto=part-8 +.br +HOMEHOST <system> .SH SEE ALSO .BR mdadm (8), @@ -1,6 +1,6 @@ Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Name: mdadm -Version: 2.4.1 +Version: 2.5 Release: 1 Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/ diff --git a/mdassemble.8 b/mdassemble.8 index a51e045..3055e82 100644 --- a/mdassemble.8 +++ b/mdassemble.8 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH MDASSEMBLE 8 "" v2.4.1 +.TH MDASSEMBLE 8 "" v2.5 .SH NAME mdassemble \- assemble MD devices .I aka @@ -712,7 +712,7 @@ static int store_super1(struct supertype *st, int fd, void *sbv) if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) { struct bitmap_super_s *bm = (struct bitmap_super_s*) - ((char*)sb)+1024; + (((char*)sb)+1024); if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) { locate_bitmap1(st, fd, sbv); write(fd, bm, sizeof(*bm)); @@ -34,7 +34,8 @@ mdsize12=19992 cleanup() { $mdadm -Ss for d in 0 1 2 3 4 5 6 7 - do losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d + do + losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d done } @@ -44,6 +45,7 @@ devlist= for d in 0 1 2 3 4 5 6 7 do [ -f $targetdir/mdtest$d ] || dd if=/dev/zero of=$targetdir/mdtest$d count=$size bs=1K > /dev/null 2>&1 + [ -b /dev/loop$d ] || mknod /dev/loop$d b 7 $d if [ $d -eq 7 ] then losetup /dev/loop$d $targetdir/mdtest6 # for multipath use diff --git a/tests/05r1-internalbitmap b/tests/05r1-internalbitmap index 19549c5..30114b0 100644 --- a/tests/05r1-internalbitmap +++ b/tests/05r1-internalbitmap @@ -30,6 +30,7 @@ fi mdadm -S $md0 mdadm --assemble -R $md0 $dev2 +mdadm --zero-superblock $dev1 mdadm $md0 --add $dev1 check recovery diff --git a/tests/05r1-n3-bitmapfile b/tests/05r1-n3-bitmapfile index a76a919..59664fb 100644 --- a/tests/05r1-n3-bitmapfile +++ b/tests/05r1-n3-bitmapfile @@ -35,6 +35,7 @@ mdadm -S $md0 mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3 check nosync +mdadm --zero-superblock $dev2 mdadm $md0 --add $dev2 check recovery |