1 |
On Wednesday 16 Oct 2013 21:14:38 Nicolas Sebrecht wrote: |
2 |
> On Wed, Oct 16, 2013 at 08:10:40PM +0200, Nicolas Sebrecht wrote: |
3 |
> > On Tue, Oct 15, 2013 at 10:42:18PM +0100, Mick wrote: |
4 |
> > > mdadm --create --auto=mdp --verbose /dev/md_d0 --level=mirror |
5 |
> > > --raid-devices=2 /dev/sda /dev/sdb |
6 |
> > > |
7 |
> > > which is thereafter partitioned with fdisk. This is the one I have |
8 |
> > > used in the past. |
9 |
> > > |
10 |
> > > Which one is preferable, or what are the pros & cons of each? |
11 |
> > |
12 |
> > For a basic RAID1, the best is to keep it as simple as possible. So |
13 |
> > mirroring while disk looks better. It will also keep MBR/GPT synced. |
14 |
> |
15 |
> s/while/the whole/ |
16 |
> |
17 |
> > I tend to make manual partitions that I mirror but this is because I |
18 |
> > usually require to do more complex setups (e.g. mixing mirror types), or |
19 |
> > because I need to have the setup more flexible. |
20 |
|
21 |
OK, I spent some time to experiment in a VM. Two small un-partitioned virtual |
22 |
disks which I used to create /dev/md0 as RAID 1 using sysrescuecd. Then I |
23 |
used fdisk to create a MSDOS partition table on /dev/md0, followed by 4 |
24 |
partitions on /dev/md0: |
25 |
====================== |
26 |
~$ fdisk -l |
27 |
|
28 |
Disk /dev/sda: 10.5 GB, 10522460160 bytes |
29 |
255 heads, 63 sectors/track, 1279 cylinders, total 20551680 sectors |
30 |
Units = sectors of 1 * 512 = 512 bytes |
31 |
Sector size (logical/physical): 512 bytes / 512 bytes |
32 |
I/O size (minimum/optimal): 512 bytes / 512 bytes |
33 |
Disk identifier: 0x00000000 |
34 |
|
35 |
Disk /dev/sda doesn't contain a valid partition table |
36 |
|
37 |
Disk /dev/sdb: 10.5 GB, 10522460160 bytes |
38 |
255 heads, 63 sectors/track, 1279 cylinders, total 20551680 sectors |
39 |
Units = sectors of 1 * 512 = 512 bytes |
40 |
Sector size (logical/physical): 512 bytes / 512 bytes |
41 |
I/O size (minimum/optimal): 512 bytes / 512 bytes |
42 |
Disk identifier: 0x00000000 |
43 |
|
44 |
Disk /dev/sdb doesn't contain a valid partition table |
45 |
|
46 |
Disk /dev/md0: 10.5 GB, 10521337856 bytes |
47 |
2 heads, 4 sectors/track, 2568686 cylinders, total 20549488 sectors |
48 |
Units = sectors of 1 * 512 = 512 bytes |
49 |
Sector size (logical/physical): 512 bytes / 512 bytes |
50 |
I/O size (minimum/optimal): 512 bytes / 512 bytes |
51 |
Disk identifier: 0x000c3148 |
52 |
|
53 |
Device Boot Start End Blocks Id System |
54 |
/dev/md0p1 * 2048 718847 358400 83 Linux |
55 |
/dev/md0p2 718848 3790847 1536000 82 Linux swap / Solaris |
56 |
/dev/md0p3 3790848 18470911 7340032 83 Linux |
57 |
/dev/md0p4 18470912 20549487 1039288 83 Linux |
58 |
====================== |
59 |
|
60 |
So, no partition tables on /dev/sda or /dev/sdb drives and of course no |
61 |
partitions at all. The partitions were created on the /dev/md0 block device. |
62 |
|
63 |
I then rebooted with a Ubuntu server CD and installed the OS in the |
64 |
above filesystem. It seemed to have recognised the RAID1 array as /dev/md127, |
65 |
instead of /dev/md0. |
66 |
|
67 |
Trying to install GRUB on /dev/sda, or /dev/sdb, or /dev/md127p1 failed. The |
68 |
only way to install GRUB and complete the Ubuntu server OS installation was to |
69 |
install it on /dev/md127, which it accepted. However, on rebooting it failed |
70 |
with: "FATAL: No boot medium found! System halted." |
71 |
|
72 |
|
73 |
Rebooting with sysrescueCD and selecting to scan and boot any linux OS it |
74 |
could find, it picks up the RAID1 installation and it boots into it without |
75 |
any problem. This is what I can see now: |
76 |
====================== |
77 |
~$ lsblk |
78 |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT |
79 |
sda 8:0 0 9.8G 0 disk |
80 |
└─md0 9:0 0 9.8G 0 raid1 |
81 |
├─md0p1 259:0 0 350M 0 md /boot |
82 |
├─md0p2 259:1 0 1.5G 0 md [SWAP] |
83 |
├─md0p3 259:2 0 7G 0 md / |
84 |
└─md0p4 259:3 0 1015M 0 md /home |
85 |
sdb 8:16 0 9.8G 0 disk |
86 |
└─md0 9:0 0 9.8G 0 raid1 |
87 |
├─md0p1 259:0 0 350M 0 md /boot |
88 |
├─md0p2 259:1 0 1.5G 0 md [SWAP] |
89 |
├─md0p3 259:2 0 7G 0 md / |
90 |
└─md0p4 259:3 0 1015M 0 md /home |
91 |
====================== |
92 |
|
93 |
|
94 |
====================== |
95 |
~$ df -h -T |
96 |
Filesystem Type Size Used Avail Use% Mounted on |
97 |
/dev/md0p3 ext4 6.9G 1.2G 5.4G 18% / |
98 |
udev tmpfs 10M 8.0K 10M 1% /dev |
99 |
none tmpfs 146M 352K 146M 1% /run |
100 |
none tmpfs 5.0M 0 5.0M 0% /run/lock |
101 |
none tmpfs 730M 0 730M 0% /run/shm |
102 |
/dev/md0p1 ext2 329M 27M 285M 9% /boot |
103 |
/dev/md0p4 ext4 999M 18M 931M 2% /home |
104 |
====================== |
105 |
|
106 |
|
107 |
====================== |
108 |
~$ cat /proc/mdstat |
109 |
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] |
110 |
[raid10] |
111 |
md0 : active raid1 sda[0] sdb[1] |
112 |
10274744 blocks super 1.2 [2/2] [UU] |
113 |
|
114 |
unused devices: <none> |
115 |
====================== |
116 |
|
117 |
|
118 |
====================== |
119 |
~$ sudo blkid |
120 |
|
121 |
/dev/sr0: LABEL="sysrcd-3.8.0" TYPE="iso9660" |
122 |
/dev/sda: UUID="59195572-751a-3bd9-7771-6e5411b032c8" |
123 |
UUID_SUB="3acd1b2c-1c95-7c07-a8b2-8aa1b2a0a169" LABEL="sysresccd:0" |
124 |
TYPE="linux_raid_member" |
125 |
/dev/sdb: UUID="59195572-751a-3bd9-7771-6e5411b032c8" UUID_SUB="c63e97ba-42cb- |
126 |
c4f8-550d-f1effae33d3f" LABEL="sysresccd:0" TYPE="linux_raid_member" |
127 |
/dev/md0p1: UUID="d9dbe2bc-0453-46e4-a5b0-779e55246004" TYPE="ext2" |
128 |
/dev/md0p2: UUID="f1a41bba-d519-42d5-8b9d-19292da899bd" TYPE="swap" |
129 |
/dev/md0p3: UUID="63d67a30-b4e9-4792-a081-cf1caae281ae" TYPE="ext4" |
130 |
/dev/md0p4: UUID="d6dc0b67-cbd3-47ae-a886-34299f491279" TYPE="ext4" |
131 |
====================== |
132 |
|
133 |
|
134 |
====================== |
135 |
~$ sudo mdadm -Db /dev/md0 |
136 |
|
137 |
ARRAY /dev/md0 metadata=1.2 name=sysresccd:0 |
138 |
UUID=59195572:751a3bd9:77716e54:11b032c8 |
139 |
====================== |
140 |
|
141 |
|
142 |
====================== |
143 |
~$ sudo mdadm --detail /dev/md0 |
144 |
/dev/md0: |
145 |
Version : 1.2 |
146 |
Creation Time : Sat Oct 19 14:17:46 2013 |
147 |
Raid Level : raid1 |
148 |
Array Size : 10274744 (9.80 GiB 10.52 GB) |
149 |
Used Dev Size : 10274744 (9.80 GiB 10.52 GB) |
150 |
Raid Devices : 2 |
151 |
Total Devices : 2 |
152 |
Persistence : Superblock is persistent |
153 |
|
154 |
Update Time : Sun Oct 20 10:26:56 2013 |
155 |
State : clean |
156 |
Active Devices : 2 |
157 |
Working Devices : 2 |
158 |
Failed Devices : 0 |
159 |
Spare Devices : 0 |
160 |
|
161 |
Name : sysresccd:0 |
162 |
UUID : 59195572:751a3bd9:77716e54:11b032c8 |
163 |
Events : 19 |
164 |
|
165 |
Number Major Minor RaidDevice State |
166 |
0 8 0 0 active sync /dev/sda |
167 |
1 8 16 1 active sync /dev/sdb |
168 |
====================== |
169 |
|
170 |
|
171 |
This is my /etc/mdadm/mdadm.conf: |
172 |
====================== |
173 |
~$ cat /etc/mdadm/mdadm.conf |
174 |
# mdadm.conf |
175 |
# |
176 |
# Please refer to mdadm.conf(5) for information about this file. |
177 |
# |
178 |
|
179 |
# by default (built-in), scan all partitions (/proc/partitions) and all |
180 |
# containers for MD superblocks. alternatively, specify devices to scan, using |
181 |
# wildcards if desired. |
182 |
#DEVICE partitions containers |
183 |
|
184 |
# auto-create devices with Debian standard permissions |
185 |
CREATE owner=root group=disk mode=0660 auto=yes |
186 |
|
187 |
# automatically tag new arrays as belonging to the local system |
188 |
HOMEHOST <system> |
189 |
|
190 |
# instruct the monitoring daemon where to send mail alerts |
191 |
MAILADDR root |
192 |
|
193 |
# definitions of existing MD arrays |
194 |
ARRAY /dev/md0 metadata=1.2 UUID=59195572:751a3bd9:77716e54:11b032c8 |
195 |
|
196 |
# This file was auto-generated on Sat, 19 Oct 2013 15:23:12 +0100 |
197 |
# by mkconf $Id$ |
198 |
====================== |
199 |
|
200 |
Any ideas why the Ubuntu installation won't boot? |
201 |
|
202 |
PS. In case you ask: I'm trying with Ubuntu because the user would struggle |
203 |
to look after a Gentoo system for this implementation. |
204 |
|
205 |
-- |
206 |
Regards, |
207 |
Mick |