summaryrefslogtreecommitdiffstats
path: root/Create.c
diff options
context:
space:
mode:
authorTrela, Maciej <Maciej.Trela@intel.com>2009-12-08 16:07:47 +1100
committerNeilBrown <neilb@suse.de>2009-12-08 16:07:47 +1100
commit034b203a4754da7615d7b16bafeabfc4115dabea (patch)
treef38ae874366d829477f67131581a00b5913c7e7e /Create.c
parentf98841b3852ceb7fce56a6f818236a4af9b5a00a (diff)
downloadmdadm-034b203a4754da7615d7b16bafeabfc4115dabea.tar.gz
mdadm-034b203a4754da7615d7b16bafeabfc4115dabea.tar.xz
mdadm-034b203a4754da7615d7b16bafeabfc4115dabea.zip
Check partition tables when creating array.
When creating an array, check if the devices have partition tables and print a warning if the table or the partitions might be destroyed by array creation. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Create.c')
-rw-r--r--Create.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/Create.c b/Create.c
index 5b01b63..d104c05 100644
--- a/Create.c
+++ b/Create.c
@@ -375,11 +375,22 @@ int Create(struct supertype *st, char *mddev,
warn |= check_ext2(fd, dname);
warn |= check_reiser(fd, dname);
warn |= check_raid(fd, dname);
- if (st && strcmp(st->ss->name, "1.x") == 0 &&
+ if (strcmp(st->ss->name, "1.x") == 0 &&
+ st->minor_version >= 1)
+ /* metadata at front */
+ warn |= check_partitions(fd, dname, 0);
+ else if (level == 1 || level == LEVEL_CONTAINER)
+ /* partitions could be meaningful */
+ warn |= check_partitions(fd, dname, freesize*2);
+ else
+ /* partitions cannot be meaningful */
+ warn |= check_partitions(fd, dname, 0);
+ if (strcmp(st->ss->name, "1.x") == 0 &&
st->minor_version >= 1 &&
did_default &&
- level == 1) {
- warn = 1;
+ level == 1 &&
+ (warn & 1024) == 0) {
+ warn |= 1024;
fprintf(stderr, Name ": Note: this array has metadata at the start and\n"
" may not be suitable as a boot device. If you plan to\n"
" store '/' or '/boot' on this device please ensure that\n"