Howto mdadm » Historie » Version 5
Jeremias Keihsler, 22.09.2024 10:52
1 | 1 | Jeremias Keihsler | h1. Howto mdadm |
---|---|---|---|
2 | |||
3 | lsblk is your best friend |
||
4 | |||
5 | <pre><code class="shell"> |
||
6 | lsblk |
||
7 | </code></pre> |
||
8 | |||
9 | we are going to use partitions as base for the raid |
||
10 | |||
11 | h2. create Linux RAID partitions |
||
12 | |||
13 | <pre><code class="shell"> |
||
14 | fdisk /dev/nvme0n1 |
||
15 | </code></pre> |
||
16 | |||
17 | h3. create new GPT disklabel |
||
18 | |||
19 | <pre> |
||
20 | g |
||
21 | </pre> |
||
22 | |||
23 | h3. create new partion |
||
24 | |||
25 | <pre> |
||
26 | n |
||
27 | </pre> |
||
28 | |||
29 | h3. change type to Linux RAID |
||
30 | |||
31 | <pre> |
||
32 | t |
||
33 | </pre> |
||
34 | |||
35 | <pre> |
||
36 | 29 |
||
37 | </pre> |
||
38 | |||
39 | repeat for all drives e.g. @/dev/nvme0n1@ and @/dev/nvme1n1@ |
||
40 | 2 | Jeremias Keihsler | |
41 | check with lsblk |
||
42 | |||
43 | h2. create Raid |
||
44 | |||
45 | <pre><code class="shell"> |
||
46 | mdadm --create /dev/md20 --level=1 --raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1 |
||
47 | </code></pre> |
||
48 | |||
49 | check with lsblk |
||
50 | |||
51 | h2. create filesystem on Raid |
||
52 | |||
53 | <pre><code class="shell"> |
||
54 | mkfs.xfs /dev/md20 |
||
55 | </code></pre> |
||
56 | 3 | Jeremias Keihsler | |
57 | h2. update mdadm.conf |
||
58 | |||
59 | <pre><code class="shell"> |
||
60 | mdadm --detail --scan |
||
61 | </code></pre> |
||
62 | |||
63 | add the ARRAY info in @/etc/mdadm.conf@ |
||
64 | should look similar to this |
||
65 | |||
66 | <pre> |
||
67 | # JKE 2024-09-17 |
||
68 | #ARRAY /dev/md20 metadata=1.2 name=hostXX.example.com:20 UUID=d80d7e3a:833baf6d:a428f02d:6f27f791 |
||
69 | ARRAY /dev/md20 UUID=d80d7e3a:833baf6d:a428f02d:6f27f791 |
||
70 | </pre> |
||
71 | |||
72 | 4 | Jeremias Keihsler | h2. assemble raid |
73 | |||
74 | <pre><code class="shell"> |
||
75 | mdadm --assemble --scan |
||
76 | </code></pre> |
||
77 | |||
78 | 3 | Jeremias Keihsler | h2. check raid |
79 | |||
80 | <pre><code class="shell"> |
||
81 | cat /proc/mdstat |
||
82 | </code></pre> |
||
83 | 4 | Jeremias Keihsler | |
84 | h2. mount raid |
||
85 | |||
86 | <pre><code class="shell"> |
||
87 | mkdir /mnt/raid |
||
88 | mount /dev/md20 /mnt/raid/ |
||
89 | </code></pre> |
||
90 | |||
91 | h2. add mount to fstab |
||
92 | |||
93 | add following line to @fstab@ |
||
94 | |||
95 | <pre> |
||
96 | /dev/md20 /mnt/raid xfs defaults 0 0 |
||
97 | </pre> |
||
98 | 5 | Jeremias Keihsler | |
99 | h2. check notification works |
||
100 | |||
101 | <pre><code class="shell"> |
||
102 | mdadm --monitor --scan -1 -t |
||
103 | </code></pre> |