Gentoo Archives: gentoo-user

From: Kerin Millar <kerframil@×××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] RAID 1 on /boot
Date: Sat, 22 Feb 2014 17:40:33
Message-Id: 5308E103.1060002@fastmail.co.uk
In Reply to: Re: [gentoo-user] RAID 1 on /boot by "J. Roeleveld"
1 On 22/02/2014 11:41, J. Roeleveld wrote:
2 > On Sat, February 22, 2014 06:27, Facundo Curti wrote:
3 >> Hi all. I'm new in the list, this is my third message :)
4 >> First at all, I need to say sorry if my english is not perfect. I speak
5 >> spanish. I post here because gentoo-user-es it's middle dead, and it's a
6 >> great chance to practice my english :) Now, the problem.
7 >
8 > First of all, there are plenty of people here who don't have English as a
9 > native language. Usually we manage. :)
10 >
11 >> I'm going to get a new PC with a disc SSD 120GB and another HDD of 1TB.
12 >> But in a coming future, I want to add 2 or more disks SSD.
13 >>
14 >> Mi idea now, is:
15 >>
16 >> Disk HHD: /dev/sda
17 >> /dev/sda1 26GB
18 >> /dev/sda2 90GB
19 >> /dev/sda3 904GB
20 >>
21 >> Disk SSD: /dev/sdb
22 >> /dev/sdb1 26GB
23 >> /dev/sdb2 90GB
24 >> /dev/sdb3 4GB
25 >>
26 >> And use /dev/sdb3 as swap. (I will add more with another SSD in future)
27 >> /dev/sda3 mounted in /home/user/data (to save data unused)
28 >
29 > Why put the swap on the SSD?
30 >
31 >> And a RAID 1 with:
32 >> md0: sda1+sdb1 /
33 >> md1: sda2+sdb2 /home
34 >>
35 >> (sda1 and sda2 will be made with the flag: write-mostly. This is useful
36 >> for
37 >> disks slower).
38 >> In a future, I'm going to add more SSD's on this RAID. My idea is the
39 >> fastest I/O.
40 >>
41 >> Now. My problem/question is:
42 >> Following the gentoo's
43 >> doc<http://www.gentoo.org/doc/es/gentoo-x86+raid+lvm2-quickinstall.xml>,
44 >> it says I need to put the flag --metadata=0.9 on the RAID. My question is
45 >> ¿This will make get off the performance?.
46
47 It has no impact on performance.
48
49 >
50 > metadata=0.9 might be necessary for the BIOS of your computer to see the
51 > /boot partition. If you use an initramfs, you can use any metadata you
52 > like for the root-partition.
53
54 The BIOS should not care at all as it is charged only with loading code
55 from the MBR. However, if the intention is to use grub-0.97 then the
56 array hosting the filesystem containing /boot should:
57
58 * use RAID-1
59 * use the 0.90 superblock format
60
61 That way, grub-0.97 can read the filesystem from either block device
62 belonging to the array. Doing it any other way requires a bootloader
63 that specifically understands md (such as grub2).
64
65 There's also the neat trick of installing grub to all disks belonging to
66 the array for bootloader redundancy. However, I'm not entirely sure that
67 Code Listing 2.35 in the Gentoo doc is correct. Given that particular
68 example, I would instead do it like this:-
69
70 grub> device (hd0) /dev/sda
71 grub> root (hd0,0)
72 grub> setup (hd0)
73 grub> device (hd0) /dev/sdb
74 grub> root (hd0,0)
75 grub> setup (hd0)
76
77 The idea there is that, should it ever be necessary to boot from the
78 second disk, the disk in question would be the one enumerated first by
79 the BIOS (mapping to hd0 in grub). Therefore, grub should be installed
80 in that context across all disks. It should not be allowed to boot from
81 any given drive and subsequently try to access >=(hd1).
82
83 With grub2, it's a little easier because it is only necessary to run
84 grub-install on each of the drives:
85
86 # grub-install /dev/sda
87 # grub-install /dev/sdb
88
89 >
90 >> I only found this
91 >> document<https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-0.90_Superblock_Format>.
92 >> This says the difference, but nothing about performance and
93 >> advantages/disadvantages.
94
95 The 0.90 superblock format is subject to specific limitations that are
96 clearly described by that page. For example, it is limited to 28 devices
97 in an array, with each device being limited to 2TB in size.
98
99 Also, the 0.90 format will cause issues in certain setups because of the
100 way that it places its metadata at the end of the block device [1]. That
101 said, the 0.90 format does allow for the kernel to construct the array
102 without any intervention from userspace so it still has its uses.
103
104 The 1.2 format positions the superblock 4KiB from the beginning of the
105 device. Note that this has nothing at all to do with the data, which
106 usually begins 1MiB in. If you run mdadm -E on a member of such an
107 array, the offset will be reported as the "Data Offset". For example:
108
109 Data Offset : 2048 sectors
110
111 So, it's not a matter of alignment. Rather, the advantage of the 1.2
112 format is that it leaves a little space for bootloader code e.g. in case
113 you want to create an array from whole disks rather than disk partitions.
114
115 None of this matters to me so I tend to stick to the 1.1 format. It
116 wouldn't actually make any difference to my particular use case.
117
118
119 >>
120 >> Another question is, ¿GRUB2 still unsupporting metadata 1.2?
121 >
122 > See reply from Canek.
123 >
124 >> In case that metadata get off performance, and GRUB2 doesn't support this.
125 >> ¿Anyone knows how can I fix this to use metadata 1.2?
126 >>
127 >> I don't partitioned more, because I saw this unnecessary. I just need to
128 >> separate /home in case I need to format the system. But if I need to
129 >> separate /boot to make it work, I don't have problems doing that.
130 >>
131 >> But of course, /boot also as RAID...
132 >
133 > /boot seperate as RAID-1 and metadata=0.9 and you are safe.
134 >
135 >> ¿Somebody have any ideas to make it work?
136 >
137 > It is similar to what I do, except I don't have SSDs in my desktop.
138 >
139 > I have 2 partitions per disk:
140 > 1 : /boot (mirrored, raid-1)
141 > 2 : LVM (striped, raid-0)
142 > All other partitions (root, /usr, /home, ....) are in the LVM.
143 >
144 > I use striping for performance reasons for files I currently work with.
145 > All important data is stored and backed up on a server.
146 >
147 > For this, an initramfs is required with support for mdraid and lvm.
148
149 Some people would make a point of avoiding the initramfs requirement by
150 just having a relatively small root filesystem on RAID-1 with 0.90
151 metadata. Unfortunately, the UsrMove affair has now rendered this
152 approach impractical because /usr can no longer be separate. It's still
153 an option, though.
154
155
156 --Kerin
157
158 [1] https://savannah.gnu.org/bugs/?34250

Replies

Subject Author
Re: [gentoo-user] RAID 1 on /boot Facundo Curti <facu.curti@×××××.com>