Gentoo Archives: gentoo-user

From: Jeff Cranmer <jeff@××××××××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to get raid
Date: Mon, 09 Jan 2012 02:03:36
Message-Id: 1326056536.15344.3.camel@office-desktop.gateway.2wire.net
In Reply to: Re: [gentoo-user] How to get raid by Jeff Cranmer
1 On Sun, 2012-01-08 at 15:03 -0500, Jeff Cranmer wrote:
2 > On Sun, 2012-01-08 at 12:31 -0600, Paul Hartman wrote:
3 > > >
4 > > > What is going on here?
5 > >
6 > > (I didn't read this whole thread, sorry if I'm repeating someone else's
7 > > advice)
8 > >
9 > > kernel autodetection only works on old superblock version 0.90, you're
10 > > using 1.2. Not a big deal, we use mdadm to do it.
11 > >
12 > > Define your arrays in /etc/mdadm.conf and start /etc/init.d/mdadm in
13 > > your boot runscripts with "rc-update add mdadm boot", it will bring up
14 > > the array at boot time.
15 > >
16 > > In my mdadm.conf i have a line like this:
17 > >
18 > > ARRAY /dev/md1 metadata=1.01 name=black:1
19 > > UUID=8e653e72:9d5df6ba:bb66ea8b:02f1c317
20 > >
21 > > (might be word-wrapped, should be all one line)
22 > >
23 > > That's all that was needed to bring it up automatically at boot time.
24 > >
25 > > Also AFAIR there was a "gotcha" about the hostname stored in the array's
26 > > metadata must match your machine's hostname or else mdadm auto-assemble
27 > > won't accept it (to protect you in case you're plugging disks from
28 > > another machine for recovery, you don't want it to use them as your main
29 > > drives), so in that case you must specify it explicitly or set the AUTO
30 > > parameter in mdadm.conf to accept this condition. If you created the
31 > > array from within a LiveCD or on another machine, the hostname might not
32 > > match your system.
33 > >
34 > > See the mdadm manpage for more info.
35 >
36 > mdadm was added to the default level, not boot.
37 > My /etc/mdadm.conf file has two active lines
38 > DEVICE /dev/sd[bcd]1
39 > ARRAY dev/md0 metadata=1.2 spares=1 name=office-desktop:0
40 > devices=/dev/sdb1,dev/sdc1,/dev/sdd1
41 >
42 > It looks like I'm having trouble with a faulty /dev/sdc1, so what I'd
43 > like to do is wipe out the existing array and try starting a RAID1 array
44 > just with sdb1 and sdd1.
45 >
46 > I got rid of the old array by using the commands
47 > mdadm --manage --fail /dev/md0
48 > mdadm --manage --stop /dev/md0
49 >
50 > I then used mdadm --verbose --create /dev/md0 --level=1
51 > --raid-devices=2 /dev/sdb1 /dev/sdd1
52 >
53 > The result of this command was
54 > dadm: /dev/sdb1 appears to be part of a raid array:
55 > level=raid5 devices=3 ctime=Sat Jan 7 08:16:00 2012
56 > mdadm: partition table exists on /dev/sdb1 but will be lost or
57 > meaningless after creating array
58 > mdadm: Note: this array has metadata at the start and
59 > may not be suitable as a boot device. If you plan to
60 > store '/boot' on this device please ensure that
61 > your boot-loader understands md/v1.x metadata, or use
62 > --metadata=0.90
63 > mdadm: /dev/sdd1 appears to be part of a raid array:
64 > level=raid5 devices=3 ctime=Sat Jan 7 08:16:00 2012
65 > mdadm: size set to 1465136400K
66 > Continue creating array? y
67 > mdadm: Defaulting to version 1.2 metadata
68 > mdadm: array /dev/md0 started.
69 >
70 > The results of cat /proc/mdstat are
71 > Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5]
72 > [raid4] [multipath]
73 > md0 : active raid1 sdd1[1] sdb1[0]
74 > 1465136400 blocks super 1.2 [2/2] [UU]
75 > [>....................] resync = 2.1% (31838144/1465136400)
76 > finish=269.7min speed=88551K/sec
77 >
78 > unused devices: <none>
79 >
80 > Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5]
81 > [raid4] [multipath]
82 > md0 : active raid1 sdd1[1] sdb1[0]
83 > 1465136400 blocks super 1.2 [2/2] [UU]
84 > [>....................] resync = 2.1% (31838144/1465136400)
85 > finish=269.7min speed=88551K/sec
86 >
87 > unused devices: <none>
88 >
89 > The results of mdadm --detail /dev/md0 are
90 > /dev/md0:
91 > Version : 1.2
92 > Creation Time : Sun Jan 8 14:47:43 2012
93 > Raid Level : raid1
94 > Array Size : 1465136400 (1397.26 GiB 1500.30 GB)
95 > Used Dev Size : 1465136400 (1397.26 GiB 1500.30 GB)
96 > Raid Devices : 2
97 > Total Devices : 2
98 > Persistence : Superblock is persistent
99 >
100 > Update Time : Sun Jan 8 14:48:54 2012
101 > State : active, resyncing
102 > Active Devices : 2
103 > Working Devices : 2
104 > Failed Devices : 0
105 > Spare Devices : 0
106 >
107 > Rebuild Status : 2% complete
108 >
109 > Name : office-desktop:0 (local to host office-desktop)
110 > UUID : bfc16c6e:4e8cb910:96ff7ed2:6fec32bc
111 > Events : 1
112 >
113 > Number Major Minor RaidDevice State
114 > 0 8 17 0 active sync /dev/sdb1
115 > 1 8 49 1 active sync /dev/sdd1
116 >
117 > When I try to mount this drive, however, I get
118 > mount: /dev/md0: can't read superblock
119 >
120 > What do I need to do to complete the process?
121 >
122 > Thanks
123 >
124 > Jeff
125 >
126 >
127 >
128 Success - I managed to get a raid1 device operating.
129 I created the final filesystem by using mkfs.xfs -f /dev/md0, then
130 waited for the rebuild to complete before rebooting the system.
131
132 It appears to be created successfully. Now I'll try the same sequence
133 with sdb and sdc to see if sdc is a good disk. If that works, I'll
134 retry a raid5 array tomorrow night.
135
136 Jeff

Replies

Subject Author
Re: [gentoo-user] How to get raid Jeff Cranmer <jeff@××××××××××××××.com>