Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Converting to mirror - filesystem maintained or need to restore
Date: Sat, 18 Mar 2017 11:29:48
Message-Id: CAGfcS_kxFFRuV7Km13LkoggNwKybEFHQH79ziOCDLUSW06aaOg@mail.gmail.com
In Reply to: Re: [gentoo-user] Converting to mirror - filesystem maintained or need to restore by Neil Bothwick
1 On Sat, Mar 18, 2017 at 5:14 AM, Neil Bothwick <neil@××××××××××.uk> wrote:
2 > On Sat, 18 Mar 2017 13:29:36 +1100, Adam Carter wrote:
3 >
4 >> IIRC when you add a device to a mirror say with;
5 >> mdadm --create --verbose /dev/md127 --level=mirror --raid-devices=1
6 >> --force /dev/sdb3
7 >>
8 >> I thought the filesystem is maintained and so /dev/md127 should be
9 >> immediately mountable, however, it doesnt mount.
10 >> mount: wrong fs type, bad option, bad superblock on /dev/md127,
11 >> missing codepage or helper program, or other error
12 >
13 > You have created a block device at /dev/md127 but you haven't created a
14 > filesystem on it, there's nothing to mount.
15 >
16 > Unless you are trying to add a device to an existing array, in which case
17 > you shouldn't be using --create.
18 >
19
20 Yeah, if you are sticking "--force" on a command line you had better
21 know exactly what you're doing. I suspect that mdadm was refusing to
22 wipe out the existing array and destroy all the data on it until this
23 was added.
24
25 mdadm is quite versatile. You can add/remove individual disks from
26 any type of raid online without losing data (well, removing disks may
27 require resizing filesystems first as the device could get truncated
28 depending on what you're doing).
29
30 However, --create is not used to modify existing arrays, unless by
31 modify you mean delete-the-old-and-create-something-new.
32
33 Since you only specified one device, you might actually be able to
34 recover. I'm not sure what your existing device was, but if it wasn't
35 /dev/sdb3 then what you might have done is create a second array with
36 the same device name. Now, /dev/md127 at that moment will point to
37 the new empty array, but the old array may still be untouched on disk,
38 so you might be able to activate it and still have all the data. Then
39 you could delete the new array (be VERY careful here that you're
40 deleting the right one), and then correctly add /dev/sdb3 to the old
41 array.
42
43 Can you spell out your configuration? What devices constituted your
44 original array and what was it called? What device did you intend to
45 add to it? What happens when you run mdadm --query <device> and mdadm
46 --examine <device> on both your old and new devices?
47
48 I'll confess that it has been a few years since I've used mdadm but if
49 the actual disks are still intact then you should be able to
50 re-assemble everything correctly.
51
52 --
53 Rich

Replies

Subject Author
Re: [gentoo-user] Converting to mirror - filesystem maintained or need to restore Adam Carter <adamcarter3@×××××.com>