Projekt

Allgemein

Profil

Howto mdadm » Historie » Revision 4

Revision 3 (Jeremias Keihsler, 17.09.2024 11:39) → Revision 4/5 (Jeremias Keihsler, 17.09.2024 13:43)

h1. Howto mdadm 

 lsblk is your best friend 

 <pre><code class="shell"> 
 lsblk 
 </code></pre> 

 we are going to use partitions as base for the raid 

 h2. create Linux RAID partitions 

 <pre><code class="shell"> 
 fdisk /dev/nvme0n1 
 </code></pre> 

 h3. create new GPT disklabel 

 <pre> 
 g 
 </pre> 

 h3. create new partion 

 <pre> 
 n 
 </pre> 

 h3. change type to Linux RAID 

 <pre> 
 t 
 </pre> 

 <pre> 
 29 
 </pre> 

 repeat for all drives e.g. @/dev/nvme0n1@ and @/dev/nvme1n1@ 

 check with lsblk 

 h2. create Raid 

 <pre><code class="shell"> 
 mdadm --create /dev/md20 --level=1 --raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1 
 </code></pre> 

 check with lsblk 

 h2. create filesystem on Raid 

 <pre><code class="shell"> 
 mkfs.xfs /dev/md20 
 </code></pre> 

 h2. update mdadm.conf 

 <pre><code class="shell"> 
 mdadm --detail --scan 
 </code></pre> 

 add the ARRAY info in @/etc/mdadm.conf@ 
 should look similar to this 

 <pre> 
 # JKE 2024-09-17 
 #ARRAY /dev/md20 metadata=1.2 name=hostXX.example.com:20 UUID=d80d7e3a:833baf6d:a428f02d:6f27f791 
 ARRAY /dev/md20 UUID=d80d7e3a:833baf6d:a428f02d:6f27f791 
 </pre> 

 h2. assemble raid 

 <pre><code class="shell"> 
 mdadm --assemble --scan 
 </code></pre> 

 h2. check raid 

 <pre><code class="shell"> 
 cat /proc/mdstat 
 </code></pre> 

 h2. mount raid 

 <pre><code class="shell"> 
 mkdir /mnt/raid 
 mount /dev/md20 /mnt/raid/ 
 </code></pre> 

 h2. add mount to fstab 

 add following line to @fstab@ 

 <pre> 
 /dev/md20      /mnt/raid      xfs     defaults     0 0 
 </pre>