Gentoo Archives: gentoo-user

From: Evgeny Bushkov <zhen@×××××××××.ru>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] mdadm and raid4
Date: Wed, 04 May 2011 13:23:08
Message-Id: 4DC152E1.5070809@dotcomltd.ru
In Reply to: Re: [gentoo-user] mdadm and raid4 by Florian Philipp
1 On 04.05.2011 16:45, Florian Philipp wrote:
2 > Am 04.05.2011 14:39, schrieb Florian Philipp:
3 >> Am 04.05.2011 11:08, schrieb Evgeny Bushkov:
4 >>> On 04.05.2011 11:54, Joost Roeleveld wrote:
5 >>>> On Wednesday 04 May 2011 10:07:58 Evgeny Bushkov wrote:
6 >>>>> On 04.05.2011 01:49, Florian Philipp wrote:
7 >>>>>> Am 03.05.2011 19:54, schrieb Evgeny Bushkov:
8 >>>>>>> Hi.
9 >>>>>>> How can I find out which is the parity disk in a RAID-4 soft array? I
10 >>>>>>> couldn't find that in the mdadm manual. I know that RAID-4 features a
11 >>>>>>> dedicated parity disk that is usually the bottleneck of the array, so
12 >>>>>>> that disk must be as fast as possible. It seems useful to employ a few
13 >>>>>>> slow disks with a relatively fast disk in such a RAID-4 array.
14 >>>>>>>
15 >>>>>>> Best regards,
16 >>>>>>> Bushkov E.
17 >>>>>> You are seriously considering a RAID4? You know, there is a reason why
18 >>>>>> it was superseded by RAID5. Given the way RAID4 operates, a first guess
19 >>>>>> for finding the parity disk in a running array would be the one with the
20 >>>>>> worst SMART data. It is the parity disk that dies the soonest.
21 >>>>>>
22 >>>>>> From looking at the source code it seems like the last specified disk is
23 >>>>>> parity. Disclaimer: I'm no kernel hacker and I have only inspected the
24 >>>>>> code, not tried to understand the whole MD subsystem.
25 >>>>>>
26 >>>>>> Regards,
27 >>>>>> Florian Philipp
28 >>>>> Thank you for answering... The reason I consider RAID-4 is a few
29 >>>>> sata/150 drives and a pair of sata II drives I've got. Let's look at
30 >>>>> the problem from the other side: I can create RAID-0(from sata II
31 >>>>> drives) and then add it to RAID-4 as the parity disk. It doesn't bother
32 >>>>> me if any disk from the RAID-0 fails, that wouldn't disrupt my RAID-4
33 >>>>> array. For example:
34 >>>>>
35 >>>>> mdadm --create /dev/md1 --level=4 -n 3 -c 128 /dev/sdb1 /dev/sdc1 missing
36 >>>>> mdadm --create /dev/md2 --level=0 -n 2 -c 128 /dev/sda1 /dev/sdd1
37 >>>>> mdadm /dev/md1 --add /dev/md2
38 >>>>>
39 >>>>> livecd ~ # cat /proc/mdstat
40 >>>>> Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
41 >>>>> md2 : active raid0 sdd1[1] sda1[0]
42 >>>>> 20969472 blocks super 1.2 128k chunks
43 >>>>>
44 >>>>> md1 : active raid4 md2[3] sdc1[1] sdb1[0]
45 >>>>> 20969216 blocks super 1.2 level 4, 128k chunk, algorithm 0 [3/2] [UU_]
46 >>>>> [========>............] recovery = 43.7% (4590464/10484608) finish=1.4min
47 >>>>> speed=69615K/sec
48 >>>>>
49 >>>>> That configuration works well, but I'm not sure if md1 is the parity
50 >>>>> disk here, that's why I asked. May be I'm wrong and RAID-5 is the only
51 >>>>> worth array, I'm just trying to consider all pros and cons here.
52 >>>>>
53 >>>>> Best regards,
54 >>>>> Bushkov E.
55 >>>> I only use RAID-0 (when I want performance and don't care about the data),
56 >>>> RAID-1 (for data I can't afford to loose) and RAID-5 (data I would like to
57 >>>> keep). I have never bothered with RAID-4.
58 >>>>
59 >> [...]
60 >>> I've run some tests with different chunk sizes, the fastest was
61 >>> raid-10(4 disks), raid-5(3 disks) was closely after. Raid-4(4 disks) was
62 >>> almost as fast as raid-5 so I don't see any sense to use it.
63 >>>
64 >>> Best regards,
65 >>> Bushkov E.
66 >>>
67 >>>
68 >>>
69 >> When you have an array with uneven disk speeds, you might consider using
70 >> the --write-mostly option of mdadm:
71 >> -W, --write-mostly
72 >> subsequent devices lists in a --build, --create, or --add command
73 >> will be flagged as 'write-mostly'. This is valid for RAID1 only and
74 >> means that the 'md' driver will avoid reading from these devices if at
75 >> all possible. This can be useful if mirroring over a slow link.
76 >>
77 >> This should help in concurrent read and write operations because the
78 >> kernel will not dispatch read requests to a disk that is already having
79 >> trouble managing the write operations.
80 >>
81 >> On another point: Are you sure your disks have different speeds? SATA150
82 >> and 300 are no reliable indicator because most HDDs cannot saturate the
83 >> SATA port anyway. dd is still the most reliable way to measure
84 >> sequential throughput.
85 >>
86 >> Regards,
87 >> Florian Philipp
88 >>
89 > `man 4 md` also states that the "the last of the active devices in the
90 > array" is the parity disk in a RAID4.
91 >
92 > Regards,
93 > Florian Philipp
94 >
95 Thank you, that's what I was searching for. It seems I configured my
96 RAID-4 right. Nonetheless that array wasn't better than RAID-5. Finally
97 I created RAID-5 (two sataII drives and 1 sata/150) with lvm.
98 From a test "time dd if=/dev/zero of=/mnt/gentoo/bigfile bs=1M
99 count=3000" I've got 163 MB/s. That in any way better than my 1-disk
100 system(46.7 MB/s from the same test) that I've been using.
101 As regard interfaces speeds I ran hdparm command and got:
102 livecd src # hdparm -i /dev/sd[abd]|grep UDMA
103 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
104 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
105 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
106 So you are right, all the drives seem to utilize the same interface speed.
107
108 Best regards,
109 Bushkov E.