⬅️ **[[$-Tools|Tools]]** | **[[$-Linux|Linux]]**
***
# Raid
Quelle:
[Ubuntu Users - Software RAID](https://wiki.ubuntuusers.de/Software-RAID/) funktioniertp
http://www.prontosystems.org/tux/software_raid
https://linoxide.com/raid-mirror-disks-in-linux/
[Software RAID mit MDADM verwalten – Thomas-Krenn-Wiki](https://www.thomas-krenn.com/de/wiki/Software_RAID_mit_MDADM_verwalten)
## Befehle Übersicht
```bash
# Raid 0 striping
mdadm --create --verbose /dev/md0 --auto md --level=0 --raid-devices=2 /dev/sda1 /dev/sdb1
# Raid 1 mirroring
mdadm --create --verbose /dev/md0 --auto md --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
# File System
mkfs.ext4 /dev/md0
# Mounting
mount /dev/md0 /mnt/Raid_250
blkid
/etc/fstab
/dev/md0 /mnt/Raid_250 ext4 defaults 0 2
# Raid Information
cat /proc/mdstat
mdadm --detail /dev/md0
# Config
# Die Konfigurationsdatei kann bequem mit einem Skript von mdadm erstellt werden und enthält dann direkt alle Definitionen aller momentan aktiven RAIDs
sudo su -c "/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf"
/etc/mdadm/mdadm.conf
```
## Tests und Revovery
1. Check information
```
sudo blkid
sudo mdadm --detail /dev/md0
cat /proc/mdstat
```
2. SSD (rotes Kabel) rausziehen
- Amicron starten -> Verbindung ok
- sudo mdadm --detail /dev/md0
- State: clean --> clean, degraded
- /dev/sda hat State removed
- **Funktioniert, als wäre nichts**
```bash
mauritz@MCE-Server:~$ sudo mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Mon Aug 1 16:04:18 2022
Raid Level : raid1
Array Size : 244066432 (232.76 GiB 249.92 GB)
Used Dev Size : 244066432 (232.76 GiB 249.92 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Mon Aug 8 09:52:56 2022
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Consistency Policy : bitmap
Name : MCE-Server:0 (local to host MCE-Server)
UUID : e3a40833:f3d7980f:55f70785:6ef291da
Events : 3414
Number Major Minor RaidDevice State
- 0 0 0 removed
1 8 16 1 active sync /dev/sdb
```
#
***
Related:
- [[$-Linux|Linux]]