Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [O/T] RAID help - now won't boot
Date: Thu, 24 Oct 2013 18:54:04
Message-Id: 201310241953.44553.michaelkintzios@gmail.com
In Reply to: [gentoo-user] Re: [O/T] RAID help - now won't boot by Nicolas Sebrecht
1 On Tuesday 22 Oct 2013 08:10:18 Nicolas Sebrecht wrote:
2 > The 21/10/13, Mick wrote:
3 > > I'm fast gravitating towards this option ...
4 > >
5 > > Although with metadata 0.90 I was able to progress with the installation
6 > > (after I deselected the swap partitions) the grub-install script wanted
7 > > to install in /dev/md127p1 but it failed. I had to override the Ubuntu
8 > > installer since I could only install grub in the /dev/md127 block
9 > > device.
10 >
11 > Which is the one we expect. /dev/md127p1 is the first partition of
12 > /dev/md127.
13
14 Right, although Ubuntu's installer would point only to /dev/md127p1. I had to
15 ask it to not install GRUB in the MBR (why would it choose /dev/md127p1 as the
16 device where the MBR resides is another matter) which then allowed me to edit
17 the entry and point it to /dev/md127. Pointing GRUB installer to /dev/sda or
18 sdb failed (no filesystem found).
19
20
21 > > Either way, it won't boot again. Now it stays on a blank screen, no
22 > > error at all shown.
23 >
24 > I don't understand why this blank screen. Or do you mean a black screen?
25
26 Yes, sorry, poor choice of words the colour of the screen is black, and the
27 content blank (well, there is a horizontal, non-flashing cursor at the top
28 left of the screen).
29
30
31 > > I'll have another go with sysrescueCD to see if I install grub on
32 > > /dev/sda and /dev/sdb and if this does not work either,
33 >
34 > It should work. Linux software RAID is assembled once the kernel is up
35 > and running. Before, the system boot as usual on a single disk. Though,
36 > I'm not sure how mdadm will handle the disk change behind his back.
37
38 Yes, it will! :-)
39
40 OK, having tried a couple of options this is what I have concluded.
41
42 Superblock with metadata 0.90 is written at the front of the disk. No need to
43 partition each disk separately, because any partitions created on /dev/md0
44 also show up on each disk, i.e. the partition table created on /dev/md0 seems
45 to be readily recognised on each /dev/sda & sdb disks, as can be verified with
46 fdisk -l. Installing grub on /dev/sda and /dev/sdb is a straight forward
47 exercise either with the Ubuntu installer, or afterwards once booted into the
48 new installation with sysrescueCD.
49
50 With any other metadata format things are more complicated. This may be
51 because the location of the metadata changes (not always at the start of the
52 disk) or because the format is different and the kernel doesn't deal with it
53 natively. Not sure and it doesn't matter. This is what I did to be able to
54 use mdadm -e 1.2, which is the default metadata format these days:
55
56
57 Boot with sysrescueCD to create the array and partitions on it
58 ==============================================================
59 mdadm --create --auto=mdp --verbose /dev/md0 --level=mirror --raid-devices=2 \
60 /dev/sda /dev/sdb
61
62 Then fdisk /dev/md0 and create 4 partitions. Leave them all with the default
63 linux type of 83 (unless you want to use some fs exotica here). Then 'fdisk
64 /dev/sda' which will create an MSDOS partition table automatically, in case
65 the disk doesn't yet have a partition table on it. Then I created one primary
66 partition accepting the default start and end values offered by fdisk. Repeat
67 for /dev/sdb.
68
69
70 Create fs on the RAID array:
71 ===========================
72 'mkfs.ext4 -c -L <label_name> /dev/md0p1' and repeat for each partition on the
73 RAID except for the swap partition (if you have created one for this purpose).
74
75
76 Boot with Ubuntu server CD to install the OS:
77 ============================================
78 Go through the tedious installation process; yeah, I know - it is faster than
79 Gentoo, but it *feels* more tedious to me! :p
80
81 You'll find that the fs and labels are not recognised by Ubuntu's partition
82 manager. Select each RAID partition (except swap) and set a fs plus a mount
83 point. These are used by the installer to populate the fstab with. Leave the
84 partitions unformatted and ignore any warnings that come up later when you
85 write these changes on disk.
86
87 Continue with the installation until it is time to install GRUB. The
88 installer will choose /dev/md127p1. Select to *not* install GRUB in the MBR,
89 which will allow you to edit the drive entry. Choose /dev/md127 and complete
90 the installation.
91
92
93 Format a swap partition on the RAID:
94 ===================================
95 Reboot with sysrescueCD, use fdisk /dev/md0 (that's how it will be recognised
96 by sysrescueCD) and change the fs type of the swap partition to 82. Then,
97 'mkswap -c -l swap /dev/md0p2' or whichever partition you have your swap on.
98 Edit /etc/fstab to include your new swap partition. I don't know why Ubuntu's
99 installer would not accept the swap partition on a RAID1 device, but this was
100 the work around I used.
101
102
103 Install GRUB on each disk:
104 =========================
105 Reboot sysrescueCD, but now use the alternative option to boot into a Linux OS
106 on the disk. It will probe the disks, assemble the RAID1 array and boot into
107 Ubuntu OS. Install grub on /dev/sda and /dev/sdb - no need to stop the array.
108 Then 'update-initramfs -u' and from then on you can reboot into your new
109 installation.
110
111 Note, if you get a drive failure, you will need to reinstall grub in the MBR
112 of the new disk.
113
114 I've written all this from memory so please correct any errors I've made.
115
116
117 The problem (at least with grub2 which is all that I tried) is that the grub
118 installer does not take kindly to installing itself on the MBR of disks which
119 are partitionless and the position of the RAID metadata on the disk messes up
120 GRUB's ability to find the partition table. I thought that creating a
121 partition table alone will stop it having a fit, but ultimately the creation
122 of an empty partition with fd partition type was necessary.
123
124 I'm posting this in the odd chance that anyone would like to run a RAID1 with
125 RAID partitions on a single RAID device, with no LVM. It makes
126 removing/adding a disk a single line command, which reduces the likelihood of
127 operator error for the users I have in mind for this particular
128 implementation.
129
130 Thanks again for your help! :-)
131 --
132 Regards,
133 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature