Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
raid [22/03/2021 - 18:58] – thommie4 | raid [29/03/2024 - 17:59] (aktuell) – admin | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Basis Tools ====== | ====== Basis Tools ====== | ||
+ | |||
+ | [[https:// | ||
blkid zeigt Info über Block Devices, ua. UUID und PTUIID | blkid zeigt Info über Block Devices, ua. UUID und PTUIID | ||
+ | < | ||
- | < | + | '' |
+ | |||
+ | </code> | ||
smartctl -a devcice_name liest die Smart Daten der Platte aus. | smartctl -a devcice_name liest die Smart Daten der Platte aus. | ||
+ | |||
+ | < | ||
+ | hdparm -I /dev/xxx | ||
+ | |||
+ | </ | ||
+ | |||
+ | zeigt die Seriennummer der Hardware (wichtig zur Indentifikation bei Fehlern in smartctl) | ||
====== Raid Pflege bei Hetzner ====== | ====== Raid Pflege bei Hetzner ====== | ||
Zeile 17: | Zeile 29: | ||
'' | '' | ||
- | Mit mdadm /dev/md0 -r /dev/sdb1 lässt sich einen Platte gezielt aus dem Array entfernen. | + | Mit mdadm /dev/md0 -r /dev/sdb1 lässt sich einen Platte gezielt aus dem Array entfernen. |
+ | |||
+ | '' | ||
+ | |||
+ | Ab jetzt läuft das RAID Array nu noch mit einer Platte | ||
+ | |||
+ | < | ||
+ | < | ||
+ | Version : 1.2 | ||
+ | Creation Time : Thu Dec 1 18:32:25 2016 | ||
+ | Raid Level : raid1 | ||
+ | Array Size : 5860021112 (5588.55 GiB 6000.66 GB) | ||
+ | Used Dev Size : 5860021112 (5588.55 GiB 6000.66 GB) | ||
+ | Raid Devices : 2 | ||
+ | Total Devices : 1 | ||
+ | Persistence : Superblock is persistent | ||
+ | |||
+ | Update Time : Thu Mar 14 14:56:01 2024 | ||
+ | State : clean, degraded | ||
+ | | ||
+ | Working Devices : 1 | ||
+ | | ||
+ | Spare Devices : 0 | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Name : thommienas: | ||
+ | UUID : 6a3e6f11: | ||
+ | | ||
+ | |||
+ | | ||
+ | - | ||
+ | 2 | ||
+ | |||
+ | </ | ||
Hetzner braucht die Information, | Hetzner braucht die Information, | ||
Zeile 23: | Zeile 69: | ||
'' | '' | ||
- | Sobald die neue Platte ins System eingebaut ist, muss die Partitionstabelle von der **alten** auf die **neue** Platte kopiert werden. | + | Sobald die neue Platte ins System eingebaut ist, muss die Partitionstabelle von der **alten** auf die **neue** Platte kopiert werden: hier NEU (sdb) << ALT (sda). |
'' | '' | ||
Zeile 33: | Zeile 79: | ||
Danach werden die Arrays wieder neu aufgebaut | Danach werden die Arrays wieder neu aufgebaut | ||
- | '' | + | '' |
+ | |||
+ | '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | '' | ||
Die Partitionen werden jetzt automatisch wieder synchronisiert. Den Fortschritt/ | Die Partitionen werden jetzt automatisch wieder synchronisiert. Den Fortschritt/ | ||
Zeile 39: | Zeile 91: | ||
'' | '' | ||
- | Der Bootloader sollte neu installiertden, da sich ja die Device Map geändert hat: Im gebooteten System reicht ein | + | Der Bootloader sollte neu installiert werden, da sich ja die Device Map geändert hat: Im gebooteten System reicht ein |
'' | '' | ||
Zeile 48: | Zeile 100: | ||
Referenzen: [[http:// | Referenzen: [[http:// | ||
- | |||
- | ====== Datenrettung von einem RAID Array ====== | ||
- | |||
- | Manueller Array Build mit einem Laufwerk | ||
- | |||
- | '' | ||
- | |||
====== Plattentausch in einem RAID1 Array in Open Media Vault (NAS) ====== | ====== Plattentausch in einem RAID1 Array in Open Media Vault (NAS) ====== | ||
smartctl liefert Hinweise, dass die Platte einen Hieb hat: | smartctl liefert Hinweise, dass die Platte einen Hieb hat: | ||
+ | < | ||
- | < | ||
This message was generated by the smartd daemon running on: | This message was generated by the smartd daemon running on: | ||
Zeile 72: | Zeile 117: | ||
Device info: | Device info: | ||
WDC WD60EFRX-68L0BN1, | WDC WD60EFRX-68L0BN1, | ||
+ | |||
</ | </ | ||
Zeile 95: | Zeile 141: | ||
├─nvme0n1p2 259:2 0 200, | ├─nvme0n1p2 259:2 0 200, | ||
└─nvme0n1p3 259:3 0 31,9G 0 part [SWAP] | └─nvme0n1p3 259:3 0 31,9G 0 part [SWAP] | ||
+ | |||
</ | </ | ||
Zeile 107: | Zeile 154: | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WX11D3678FVK-part1 -> ../../sdc1 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WX11D3678FVK-part1 -> ../../sdc1 | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WX11D3678FVK-part2 -> ../../sdc2 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WX11D3678FVK-part2 -> ../../sdc2 | ||
- | lrwxrwxrwx 1 0 0 9 Mär 11 12:16 **ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3** -> ../../sda | + | lrwxrwxrwx 1 0 0 9 Mär 11 12:16 **ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3** |
+ | -> ../../sda | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part1 -> ../../sda1 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part1 -> ../../sda1 | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part2 -> ../../sda2 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part2 -> ../../sda2 | ||
Zeile 128: | Zeile 176: | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 wwn-0x50014ee2b83025c8-part1 -> ../../sda1 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 wwn-0x50014ee2b83025c8-part1 -> ../../sda1 | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 wwn-0x50014ee2b83025c8-part2 -> ../../sda2 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 wwn-0x50014ee2b83025c8-part2 -> ../../sda2 | ||
+ | |||
</ | </ | ||
- | |||
Aus der Liste die betroffene Platte anhand der UUID/ | Aus der Liste die betroffene Platte anhand der UUID/ | ||
Zeile 138: | Zeile 186: | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part1 -> ../../sda1 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part1 -> ../../sda1 | ||
lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part2 -> ../../sda2 | lrwxrwxrwx 1 0 0 10 Mär 11 12:16 ata-WDC_WD60EFRX-68L0BN1_WD-WXB1HB4YS7K3-part2 -> ../../sda2 | ||
+ | |||
</ | </ | ||
- | Mit mdadm --detail die Details zum aktuellen RAID Array zeigen | + | Mit mdadm –detail die Details zum aktuellen RAID Array zeigen |
< | < | ||
+ | |||
root@nas:/ | root@nas:/ | ||
/dev/md0: | /dev/md0: | ||
Zeile 170: | Zeile 219: | ||
| | ||
| | ||
+ | |||
</ | </ | ||
- | Mit mdadm --manage wird die defekte Platte als fehlerhaft markiert und danach aus dem Array entfernt: | + | Mit mdadm –manage wird die defekte Platte als fehlerhaft markiert und danach aus dem Array entfernt: |
< | < | ||
Zeile 189: | Zeile 239: | ||
md0 : active raid1 sdc2[0] sda2[1](F) | md0 : active raid1 sdc2[0] sda2[1](F) | ||
5860021112 blocks super 1.2 [2/1] **[U_]** | 5860021112 blocks super 1.2 [2/1] **[U_]** | ||
+ | |||
</ | </ | ||
Zeile 206: | Zeile 257: | ||
/ | / | ||
/ | / | ||
+ | |||
</ | </ | ||
Zeile 229: | Zeile 281: | ||
/ | / | ||
/ | / | ||
+ | |||
</ | </ | ||
- | Jetzt kann die alte Platte ausgebaut werden. Auf der neuen Platte mit gparted oder mkfs die Partitionierung analog anlegen (erst die Paritionstabelle gpt, dann die Partition selbst, in der Regel ext4). | + | Jetzt kann die alte Platte ausgebaut werden. Auf der neuen Platte mit gparted oder mkfs die Partitionierung analog anlegen (erst die Paritionstabelle gpt, dann die Partition selbst, in der Regel ext4). Nach dem Umbau quittiert smartctl das Array als degraded: |
- | + | ||
- | Nach dem Umbau quittiert smartctl das Array als degraded: | + | |
< | < | ||
Zeile 245: | Zeile 296: | ||
P.S. The / | P.S. The / | ||
- | Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | + | Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] |
md0 : active (auto-read-only) raid1 sdb2[0] | md0 : active (auto-read-only) raid1 sdb2[0] | ||
5860021112 blocks super 1.2 [2/1] [U_] | 5860021112 blocks super 1.2 [2/1] [U_] | ||
- | | + | |
unused devices: < | unused devices: < | ||
+ | |||
</ | </ | ||
Zeile 257: | Zeile 309: | ||
root@nas:~# mdadm --manage /dev/md0 --add /dev/sdc1 | root@nas:~# mdadm --manage /dev/md0 --add /dev/sdc1 | ||
mdadm: added /dev/sdc1 | mdadm: added /dev/sdc1 | ||
+ | |||
</ | </ | ||
- | Das sw raid beginnt danach, die Dateien zwischen beiden Platten zu synchronisieren: | + | Danach beginnt das sw raid, die Dateien zwischen beiden Platten zu synchronisieren: |
< | < | ||
- | root@nas:~# mdadm --detail / | + | root@nas:~# mdadm --detail /dev/md0 |
/dev/md0: | /dev/md0: | ||
| | ||
Zeile 274: | Zeile 327: | ||
| | ||
- | State : clean, degraded, recovering | + | State : clean, degraded, recovering |
Active Devices : 1 | Active Devices : 1 | ||
| | ||
Zeile 291: | Zeile 344: | ||
| | ||
** | ** | ||
+ | |||
</ | </ | ||
+ | |||
+ | ====== Variante: wenn das Array crasht ====== | ||
+ | |||
+ | **SDB new** | ||
+ | < | ||
+ | Disk model: WDC WD6003FFBX-6 | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: gpt | ||
+ | Disk identifier: DF00632A-03F7-46B4-A2D4-15C5DCE3930F | ||
+ | |||
+ | </ | ||
+ | |||
+ | **SDC OLD** | ||
+ | < | ||
+ | Disk model: WDC WD60EFPX-68C | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: gpt | ||
+ | Disk identifier: 7BC40B3C-3226-40CE-84DB-844942ED7944 | ||
+ | |||
+ | Device | ||
+ | / | ||
+ | |||
+ | </ | ||
+ | |||
+ | RAID member einzeln analysieren | ||
+ | |||
+ | < | ||
+ | root@nas:~# mdadm --examine /dev/sdc1 | ||
+ | /dev/sdc1: | ||
+ | Magic : a92b4efc | ||
+ | Version : 1.2 | ||
+ | Feature Map : 0x2 | ||
+ | Array UUID : 6a3e6f11: | ||
+ | Name : thommienas: | ||
+ | Creation Time : Thu Dec 1 18:32:25 2016 | ||
+ | Raid Level : raid1 | ||
+ | Raid Devices : 2 | ||
+ | |||
+ | Avail Dev Size : 11721041039 (5589.03 GiB 6001.17 GB) | ||
+ | Array Size : 5860021112 (5588.55 GiB 6000.66 GB) | ||
+ | Used Dev Size : 11720042224 (5588.55 GiB 6000.66 GB) | ||
+ | Data Offset : 2048 sectors | ||
+ | Super Offset : 8 sectors | ||
+ | Recovery Offset : 9190785664 sectors | ||
+ | | ||
+ | State : clean | ||
+ | Device UUID : 71a7b2c3: | ||
+ | |||
+ | Update Time : Mon Mar 25 00:31:32 2024 | ||
+ | Bad Block Log : 512 entries available at offset 264 sectors | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | Array State : AA (' | ||
+ | |||
+ | </ | ||
+ | |||
+ | Dann ein loop device mit "Data Offset : 2048 sectors" | ||
+ | |||
+ | < | ||
+ | losetup --find --show --offset=$((2048*512)) /dev/sdc1 | ||
+ | |||
+ | root@nas:~# losetup | ||
+ | NAME | ||
+ | / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Danach read only mounten | ||
+ | |||
+ | < | ||
+ | mount -o ro /dev/loop0 /mnt/sdc1 | ||
+ | |||
+ | root@nas:/ | ||
+ | aquota.group | ||
+ | |||
+ | </ | ||
+ | |||
+ | Jetzt brauchen wir ein neues RAID array mit nur einem member auf der neuen Platte\\ | ||
+ | Die Paritition wird mit fdisk /dev/sdb angelegt. Als partition type nimmt man 29 "Linux RAID". | ||
+ | |||
+ | Danach findet mdadm die Partition. Bei gpt ist der Parititon type " | ||
+ | |||
+ | < | ||
+ | root@nas:/ | ||
+ | /dev/sdb: | ||
+ | MBR Magic : aa55 | ||
+ | Partition[0] : | ||
+ | |||
+ | </ | ||
+ | |||
+ | Danach wird manuell ein RAID Array mit einem member erzeugt: | ||
+ | |||
+ | < | ||
+ | sudo mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 missing | ||
+ | |||
+ | root@nas:/ | ||
+ | mdadm: Note: this array has metadata at the start and | ||
+ | may not be suitable as a boot device. | ||
+ | store '/ | ||
+ | your boot-loader understands md/v1.x metadata, or use | ||
+ | --metadata=0.90 | ||
+ | Continue creating array? | ||
+ | |||
+ | mdadm: Defaulting to version 1.2 metadata | ||
+ | mdadm: array /dev/md1 started. | ||
+ | |||
+ | </ | ||
+ | |||
+ | Danach sieht man das neue md1 array und das alte (kaputte) md0: | ||
+ | |||
+ | < | ||
+ | root@nas:/ | ||
+ | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] | ||
+ | md1 : active raid1 sdb1[0] | ||
+ | 5860389440 blocks super 1.2 [2/1] [U_] | ||
+ | bitmap: 0/44 pages [0KB], 65536KB chunk | ||
+ | |||
+ | md0 : inactive sdc1[3](S) | ||
+ | 5860520519 blocks super 1.2 | ||
+ | |||
+ | </ | ||
+ | |||
+ | Jetzt brauchts noch ein filesystem: | ||
+ | |||
+ | < | ||
+ | mkfs.ext4 /dev/md1 | ||
+ | |||
+ | mount /dev/md1 /mnt/md1/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | Danach kann man die Daten vom alten array, das read-only läuft, ins neue umkopieren: | ||
+ | |||
+ | cp -R * /mnt/md1 & progress -mp $! | ||
+ | |||
+ | mit progress sieht man einen Fortschrittsbalken | ||
+ | |||
+ |