summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-12-05 05:54:48 +0000
committerNeil Brown <neilb@suse.de>2005-12-05 05:54:48 +0000
commit47d79ef8e5bb59f2c3207d04806d3a823a733820 (patch)
tree03035e0446e36517d4578e0f5fc312ed64b24554
parentc06487ce2061b7acfe6bc40bea7ad12393b0e4c6 (diff)
downloadmdadm-47d79ef8e5bb59f2c3207d04806d3a823a733820.tar.gz
mdadm-47d79ef8e5bb59f2c3207d04806d3a823a733820.tar.xz
mdadm-47d79ef8e5bb59f2c3207d04806d3a823a733820.zip
Support --assume-clean for --create
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--ChangeLog1
-rw-r--r--Create.c6
-rw-r--r--mdadm.89
-rw-r--r--mdadm.c2
-rw-r--r--mdadm.h2
5 files changed, 13 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 141e1b2..57a8e82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@ Changes Prior to this release
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
Changes Prior to 2.1 release
- Fix assembling of raid10 array when devices are missing.
diff --git a/Create.c b/Create.c
index 0fd38a5..9a10d16 100644
--- a/Create.c
+++ b/Create.c
@@ -35,7 +35,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
char *name,
int subdevs, mddev_dev_t devlist,
- int runstop, int verbose, int force,
+ int runstop, int verbose, int force, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay)
{
/*
@@ -288,7 +288,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
* as missing, so that a reconstruct happens (faster than re-parity)
* FIX: Can we do this for raid6 as well?
*/
- if (force == 0 && first_missing >= raiddisks) {
+ if (assume_clean==0 && force == 0 && first_missing >= raiddisks) {
switch ( level ) {
case 5:
insert_point = raiddisks-1;
@@ -318,6 +318,8 @@ int Create(struct supertype *st, char *mddev, int mdfd,
(insert_point < raiddisks || first_missing < raiddisks) )
||
( level == 6 && missing_disks == 2)
+ ||
+ assume_clean
)
array.state = 1; /* clean, but one+ drive will be missing */
else
diff --git a/mdadm.8 b/mdadm.8
index 45326f6..8e19195 100644
--- a/mdadm.8
+++ b/mdadm.8
@@ -476,9 +476,12 @@ which means to choose the largest size that fits on all current drives.
.BR --assume-clean
Tell
.I mdadm
-that the array pre-existed and is known to be clean. This is only
-really useful for Building RAID1 array. Only use this if you really
-know what you are doing. This is currently only supported for --build.
+that the array pre-existed and is known to be clean. It can be useful
+when trying to recover from a major failure as you can be sure that no
+data will be affected unless you actually write to the array. It can
+also be used when creating a RAID1 or RAID10 if you want to avoid the
+initial resync, however this practice - while normally safe - is not
+recommended. Use this ony if you really know what you are doing.
.TP
.BR -N ", " --name=
diff --git a/mdadm.c b/mdadm.c
index 80873b2..c808799 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1002,7 +1002,7 @@ int main(int argc, char *argv[])
rv = Create(ss, devlist->devname, mdfd, chunk, level, layout, size<0 ? 0 : size,
raiddisks, sparedisks, ident.name,
- devs_found-1, devlist->next, runstop, verbose-quiet, force,
+ devs_found-1, devlist->next, runstop, verbose-quiet, force, assume_clean,
bitmap_file, bitmap_chunk, write_behind, delay);
break;
case MISC:
diff --git a/mdadm.h b/mdadm.h
index 29bbdc4..8c5f2f2 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -250,7 +250,7 @@ extern int Create(struct supertype *st, char *mddev, int mdfd,
int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
char *name,
int subdevs, mddev_dev_t devlist,
- int runstop, int verbose, int force,
+ int runstop, int verbose, int force, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
extern int Detail(char *dev, int brief, int test);