Difference between revisions of "Raid"

From PostgreSQL_wiki
Jump to: navigation, search
(Uitbreiden van de array)
(Kopieer partities over volgende drives)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Software matige RAID =
 
= Software matige RAID =
Configureer de Raid voor de dom0 tijdens de installatie van de fysieke host.
+
Configureer de Raid voor de dom0 tijdens de installatie van de fysieke host. Een een softwarematige RAID bestaat op een dom0 uit meerdere md-devices. De fysieke host zelf bevat nauwelijks data en staat op de eerste partities die buiten de raid staan. In eerste instantie zijn twee disks aanwezig, later in een volgende stap van de migratie komen daar twee disks bij.<br/>
  +
Op de fysieke host zijn lvm volumes aanwezig:
== De dom0 server zelf ==
 
  +
* kvm-root
Een een softwarematige RAID bestaat op een dom0 uit meerdere md-devices. Creeer het eerste kleine device 8Gb - 20Gb tijdens de installatie volgens deze stappen:
 
  +
* kvm-data
*in the following menu, scroll to your first disk and hit enter: the partitionier asks you, if you want to create an empty partition table. Say &quot;yes&quot;. (Hint: this will erase your existing data, if any.)
 
  +
* kvm-swap
*The partitioner is back in the disk overview, scroll one line downwards over the line with &quot;FREE SPACE&quot; and hit enter.
 
  +
kvm-root en kvm-data staan in volume groups met elk een eigen raid device. kvm-swap staat in een volume group die bestaat uit gewone partities.
*Create a partition with the size you need, but remember the size and the logical type.
 
  +
== Volumes op een software raid ==
*In the &quot;Partition settings&quot; menu, go to &quot;Use as&quot; and hit enter.
 
  +
Na de installatie van nuttige software:
*Change the type to &quot;physical volume for RAID&quot;.
 
  +
root@host:~# apt-get install mdadm raidutils array-info lvm2
*Finish this partition with &quot;Done setting up the partition&quot;.
 
  +
Configuratie van een nieuw md-device:
*Create other partitions on the same disk, if you like.
 
  +
<pre>
*Now repeat all the steps from the first disk for the second disk.
 
  +
root@host:~# mdadm -v --create /dev/md0 --level=raid5 --raid-devices=2 /dev/sda3 /dev/sdb3
After this, you should have at least two disks with the same partition schema and all partitions (beside swap) should be marked for RAID use.
 
  +
root@host:~# mdadm -v --create /dev/md1 --level=raid5 --raid-devices=2 /dev/sda4 /dev/sdb4
*Now look at the first menu entry in the partitioner menu, there is a new line: &quot;Configure software RAID&quot;. Go into this menu.
 
  +
root@host:~# watch cat /proc/mdstat
*Answer the question, if you like to write the changes, with &quot;Yes&quot;.
 
  +
</pre>
*Now pick &quot;Create MD device&quot;.
 
  +
Volg het proces met:
*Use RAID1 and give the number of active and spare devices (2 and 0 in our case).
 
  +
root@host:~# watch cat /proc/mdstat
*In the following menu, select the same device number on the first and second disk and Continue.
 
  +
== Verwisselen van een schijf ==
 
  +
Een partitie die uit een raid is gevallen krijgt de status failed. Je moet de schijf zo snel mogelijk vervangen, omdat de gehele raid verloren is als er nog een partitie in dezelfde raid kapot gaat.
Repeat this step for every two devices until you are done. Then use &quot;Finish&quot; from the Multidisk configuration options.
 
  +
<pre>
 
  +
root@host:~# mdadm --remove /dev/md1 /dev/sdd4
You are back in the partitioner menu and now you see one ore more new partitions named as &quot;Software RAID Device&quot;. You can use this partitions like any normal partition and continue installing your system.
 
  +
root@host:~# mdadm --remove /dev/md0 /dev/sdd3
 
  +
</pre>
Meer info op : http://www.howtoforge.com/software-raid1-grub-boot-debian-etch
 
  +
Na het plaatsen van de nieuwe kopieer je eerst de partitie tabel van een andere schijf uit de raid, om daarna de patities weer aan de raid toe te voegen.
 
  +
<pre>
5.2.4. Managing RAID devices (RAID-1 and up!!)
 
  +
root@host:~# mdadm --add /dev/md0 /dev/sdd3
Setting a disk faulty/failed:
 
# mdadm --fail /dev/md0 /dev/hdc1
+
root@host:~# mdadm --add /dev/md1 /dev/sdd4
  +
</pre>
 
  +
Het operating system verzorgt automatisch een rebuild van de raid array.
[Caution] DO NOT run this every on a raid0 or linear device or your data is toasted!
 
Removing a faulty disk from an array:
 
# mdadm --remove /dev/md0 /dev/hdc1
 
 
Clearing any previous raid info on a disk (eg. reusing a disk from another decommissioned raid array)
 
# mdadm --zero-superblock /dev/hdc1
 
 
Adding a disk to an array
 
# mdadm --add /dev/md0 /dev/hdc1
 
   
 
= Toevoegen drives =
 
= Toevoegen drives =
Line 46: Line 38:
 
== Kopieer partities over volgende drives ==
 
== Kopieer partities over volgende drives ==
 
De beste manier om identieke partities op raid devices te maken is het kopieren van de partitie tabel over de volgende disk heen:
 
De beste manier om identieke partities op raid devices te maken is het kopieren van de partitie tabel over de volgende disk heen:
sfdisk -d /dev/sda | sfdisk /dev/sdb
+
root@host:~# sfdisk -d /dev/sda | sfdisk /dev/sdb
Dit gaat niet altijd zonder slag of stoot, zeker als je drives van verschillende merken in de array hebt. In dat geval is het noodzakelijk om de partitietabel handmatig toe te voegen.
+
Dit gaat niet altijd zonder slag of stoot, zeker als je drives van verschillende merken in de array hebt. In dat geval is het noodzakelijk om de partitietabel handmatig toe te voegen.<br>
  +
Een ander mogelijkheid is het aanmaken van een bestand partition.txt.
  +
<pre>
  +
root@host:~# sfdisk -d /dev/sda > partition.txt
  +
root@host:~# sfdisk /dev/sdb < partition.txt
  +
</pre>
  +
 
== Uitbreiden van de array ==
 
== Uitbreiden van de array ==
 
Het uitbreiden van de array gaat door eerst spares toe te voegen en daarna de array met de spares uit te breiden
 
Het uitbreiden van de array gaat door eerst spares toe te voegen en daarna de array met de spares uit te breiden
 
<pre>
 
<pre>
mdadm -a /dev/md0 /dev/sdb3 /dev/sdd3
+
root@host:~# mdadm -a /dev/md0 /dev/sdc3 /dev/sdd3
mdadm -a /dev/md1 /dev/sdb4 /dev/sdd4
+
root@host:~# mdadm -a /dev/md1 /dev/sdc4 /dev/sdd4
mdadm --grow --raid-devices=4 /dev/md0
+
root@host:~# mdadm --grow --raid-devices=4 /dev/md0
mdadm --grow --raid-devices=4 /dev/md1
+
root@host:~# mdadm --grow --raid-devices=4 /dev/md1
 
</pre>
 
</pre>
 
Volg het proces met
 
Volg het proces met
Line 60: Line 58:
 
Aan het einde van het proces laat de array de nieuwe omvang zien met
 
Aan het einde van het proces laat de array de nieuwe omvang zien met
 
<pre>
 
<pre>
mdadm --detail /dev/md0
+
root@host:~# mdadm --detail /dev/md0
mdadm --detail /dev/md1
 
</pre>
 
De nieuwe extra ruimte is nog niet beschikbaar voor het op physical volume op de array
 
<pre>
 
pvscan
 
628 pvresize /dev/md1
 
629 pvscan
 
</pre>
 
root@dom0-149:~# mdadm --detail /dev/md0
 
 
/dev/md0:
 
/dev/md0:
Version : 1.2
 
Creation Time : Sun Nov 4 14:26:21 2012
 
Raid Level : raid5
 
 
Array Size : 37722624 (35.98 GiB 38.63 GB)
 
Array Size : 37722624 (35.98 GiB 38.63 GB)
 
Used Dev Size : 12574208 (11.99 GiB 12.88 GB)
 
Used Dev Size : 12574208 (11.99 GiB 12.88 GB)
 
Raid Devices : 4
 
Raid Devices : 4
Total Devices : 4
 
Persistence : Superblock is persistent
 
 
Update Time : Wed Nov 21 06:25:12 2012
 
State : clean
 
Active Devices : 4
 
Working Devices : 4
 
Failed Devices : 0
 
Spare Devices : 0
 
 
Layout : left-symmetric
 
Chunk Size : 512K
 
 
Name : dom0-149:0 (local to host dom0-149)
 
UUID : 6e734f54:d0d226ff:36feb94a:8308e813
 
Events : 83
 
 
 
Number Major Minor RaidDevice State
 
Number Major Minor RaidDevice State
 
0 8 3 0 active sync /dev/sda3
 
0 8 3 0 active sync /dev/sda3
2 8 35 1 active sync /dev/sdc3
+
2 8 19 1 active sync /dev/sdb3
3 8 19 2 active sync /dev/sdb3
+
3 8 35 2 active sync /dev/sdc3
 
4 8 51 3 active sync /dev/sdd3
 
4 8 51 3 active sync /dev/sdd3
  +
root@host:~# mdadm --detail /dev/md1
root@dom0-149:~#
 
root@dom0-149:~# pvscan
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [212.63 GiB / 198.63 GiB free]
 
PV /dev/md0 VG kvm-root lvm2 [11.99 GiB / 3.99 GiB free]
 
Total: 3 [232.62 GiB] / in use: 3 [232.62 GiB] / in no VG: 0 [0 ]
 
root@dom0-149:~# watch cat /proc/mdstat
 
root@dom0-149:~# pvresize /dev/md0
 
Physical volume "/dev/md0" changed
 
1 physical volume(s) resized / 0 physical volume(s) not resized
 
root@dom0-149:~# pvscan
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [212.63 GiB / 198.63 GiB free]
 
PV /dev/md0 VG kvm-root lvm2 [35.97 GiB / 27.97 GiB free]
 
Total: 3 [256.60 GiB] / in use: 3 [256.60 GiB] / in no VG: 0 [0 ]
 
root@dom0-149:~#
 
 
root@dom0-149:~# mdadm --detail /dev/md1
 
 
/dev/md1:
 
/dev/md1:
Version : 1.2
 
Creation Time : Sun Nov 4 14:27:02 2012
 
Raid Level : raid5
 
 
Array Size : 668891136 (637.90 GiB 684.94 GB)
 
Array Size : 668891136 (637.90 GiB 684.94 GB)
 
Used Dev Size : 222963712 (212.63 GiB 228.31 GB)
 
Used Dev Size : 222963712 (212.63 GiB 228.31 GB)
 
Raid Devices : 4
 
Raid Devices : 4
  +
Number Major Minor RaidDevice State
Total Devices : 4
 
  +
0 8 4 0 active sync /dev/sda4
Persistence : Superblock is persistent
 
  +
2 8 20 1 active sync /dev/sdb4
  +
3 8 36 2 active sync /dev/sdc4
  +
4 8 52 3 active sync /dev/sdd4
  +
</pre>
  +
Of met:
  +
<pre>
  +
root@host:~# array-info -a -d /dev/md0
  +
MD Linux driver
  +
Version 1.2.3
  +
Creation time : Sat Apr 2 17:19:25 2557
   
  +
Fault tolerance : RAID 5
Update Time : Wed Nov 21 08:39:42 2012
 
State : clean
+
Array Size : 35.98 GiB
  +
Status : Logical drive is ok
Active Devices : 4
 
Working Devices : 4
+
Devices : 4
  +
Size : 11.99 GiB
Failed Devices : 0
 
Spare Devices : 0
+
Raid : 4
  +
Active : 4
  +
Working : 4
  +
Failed : 0
  +
Spare : 0
  +
RaidDevice State
  +
0 active synchronized
  +
-1 removed
  +
1 active synchronized
  +
2 active synchronized
  +
root@host:/etc/mdadm# array-info -a -d /dev/md1
  +
MD Linux driver
  +
Version 1.2.3
  +
Creation time : Sat Apr 2 17:20:06 2557
   
  +
Fault tolerance : RAID 5
Layout : left-symmetric
 
Chunk Size : 512K
+
Array Size : 637.90 GiB
  +
Status : Logical drive is ok
  +
Devices : 4
  +
Size : 212.63 GiB
  +
Raid : 4
  +
Active : 4
  +
Working : 4
  +
Failed : 0
  +
Spare : 0
  +
RaidDevice State
  +
0 active synchronized
  +
-1 removed
  +
1 active synchronized
  +
3 active synchronized
  +
root@host:/etc/mdadm#
  +
</pre>
   
  +
== Extra ruimte array toekennen ==
Name : dom0-149:1 (local to host dom0-149)
 
  +
De nieuwe extra ruimte is nog niet beschikbaar voor het physical volume op de array, toekennen gaat met pvresize.
UUID : 6e065d11:4fbae631:5eb4952e:8f46d8c8
 
  +
<pre>
Events : 1049
 
  +
root@host:~# pvscan
 
Number Major Minor RaidDevice State
 
0 8 4 0 active sync /dev/sda4
 
2 8 36 1 active sync /dev/sdc4
 
4 8 52 2 active sync /dev/sdd4
 
3 8 20 3 active sync /dev/sdb4
 
root@dom0-149:~# pvscan
 
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [212.63 GiB / 198.63 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [212.63 GiB / 198.63 GiB free]
PV /dev/md0 VG kvm-root lvm2 [35.97 GiB / 27.97 GiB free]
+
PV /dev/md0 VG kvm-root lvm2 [11.99 GiB / 3.99 GiB free]
Total: 3 [256.60 GiB] / in use: 3 [256.60 GiB] / in no VG: 0 [0 ]
+
Total: 3 [232.62 GiB] / in use: 3 [232.62 GiB] / in no VG: 0 [0 ]
root@dom0-149:~# pvresize /dev/md1
+
root@host:~# pvresize /dev/md0
  +
Physical volume "/dev/md0" changed
  +
1 physical volume(s) resized / 0 physical volume(s) not resized
  +
root@host:~# pvresize /dev/md1
  +
root@host:~# mdadm --detail /dev/md1
 
Physical volume "/dev/md1" changed
 
Physical volume "/dev/md1" changed
 
1 physical volume(s) resized / 0 physical volume(s) not resized
 
1 physical volume(s) resized / 0 physical volume(s) not resized
root@dom0-149:~# pvscan
+
root@host:~# pvscan
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/sdc5 VG kvm-swap lvm2 [8.00 GiB / 7.12 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [637.90 GiB / 623.90 GiB free]
 
PV /dev/md1 VG kvm-data lvm2 [637.90 GiB / 623.90 GiB free]
 
PV /dev/md0 VG kvm-root lvm2 [35.97 GiB / 27.97 GiB free]
 
PV /dev/md0 VG kvm-root lvm2 [35.97 GiB / 27.97 GiB free]
 
Total: 3 [681.87 GiB] / in use: 3 [681.87 GiB] / in no VG: 0 [0 ]
 
Total: 3 [681.87 GiB] / in use: 3 [681.87 GiB] / in no VG: 0 [0 ]
root@dom0-149:~# history
+
root@host:~#
 
== lvm op een software raid ==
 
Na de installatie van nuttige software:
 
root@host:~# apt-get install mdadm raidutils array-info
 
Configuratie van een nieuw md-device:
 
<pre>
 
root@host:~# cat /proc/mdstat
 
root@host:~# mdadm -v --create /dev/md0 --level=raid5 --raid-devices=2 /dev/sda5 /dev/sdb5
 
</pre>
 
Volg het proces met:
 
root@host:~# watch cat /proc/mdstat
 
<pre>
 
root@host:~# pvcreate /dev/md0
 
root@host:~# pvscan
 
root@host:~# array-info -v -d /dev/md0
 
root@host:~# pvdisplay
 
root@host:~# vgcreate kvm-root /dev/md0
 
 
</pre>
 
</pre>
  +
<hr>
Volg hierna de normale procedure voor het bouwen van een domU.
 
  +
Terug naar: [[Webhuis bouwstenen]]

Latest revision as of 15:04, 31 August 2013

Software matige RAID

Configureer de Raid voor de dom0 tijdens de installatie van de fysieke host. Een een softwarematige RAID bestaat op een dom0 uit meerdere md-devices. De fysieke host zelf bevat nauwelijks data en staat op de eerste partities die buiten de raid staan. In eerste instantie zijn twee disks aanwezig, later in een volgende stap van de migratie komen daar twee disks bij.
Op de fysieke host zijn lvm volumes aanwezig:

  • kvm-root
  • kvm-data
  • kvm-swap

kvm-root en kvm-data staan in volume groups met elk een eigen raid device. kvm-swap staat in een volume group die bestaat uit gewone partities.

Volumes op een software raid

Na de installatie van nuttige software:

root@host:~# apt-get install mdadm raidutils array-info lvm2

Configuratie van een nieuw md-device:

root@host:~# mdadm -v --create /dev/md0 --level=raid5 --raid-devices=2 /dev/sda3 /dev/sdb3
root@host:~# mdadm -v --create /dev/md1 --level=raid5 --raid-devices=2 /dev/sda4 /dev/sdb4
root@host:~# watch cat /proc/mdstat

Volg het proces met:

root@host:~# watch cat /proc/mdstat

Verwisselen van een schijf

Een partitie die uit een raid is gevallen krijgt de status failed. Je moet de schijf zo snel mogelijk vervangen, omdat de gehele raid verloren is als er nog een partitie in dezelfde raid kapot gaat.

root@host:~# mdadm --remove /dev/md1 /dev/sdd4
root@host:~# mdadm --remove /dev/md0 /dev/sdd3

Na het plaatsen van de nieuwe kopieer je eerst de partitie tabel van een andere schijf uit de raid, om daarna de patities weer aan de raid toe te voegen.

root@host:~# mdadm --add /dev/md0 /dev/sdd3
root@host:~# mdadm --add /dev/md1 /dev/sdd4

Het operating system verzorgt automatisch een rebuild van de raid array.

Toevoegen drives

Voeg aan een bestaande raid5 configuratie met twee drives twee extra drives toe. Dit gaat in stappen:

  • Kopieer de partitie tabel van de tweed drive naar drives drie en vier
  • Voeg de relevante partities van beide drives als spare toe
  • Breid het aantal devices van de array uit
  • Breid het physical volume van de array uit

Kopieer partities over volgende drives

De beste manier om identieke partities op raid devices te maken is het kopieren van de partitie tabel over de volgende disk heen:

root@host:~# sfdisk -d /dev/sda | sfdisk /dev/sdb

Dit gaat niet altijd zonder slag of stoot, zeker als je drives van verschillende merken in de array hebt. In dat geval is het noodzakelijk om de partitietabel handmatig toe te voegen.
Een ander mogelijkheid is het aanmaken van een bestand partition.txt.

root@host:~# sfdisk -d /dev/sda > partition.txt
root@host:~# sfdisk /dev/sdb < partition.txt

Uitbreiden van de array

Het uitbreiden van de array gaat door eerst spares toe te voegen en daarna de array met de spares uit te breiden

root@host:~# mdadm -a /dev/md0 /dev/sdc3 /dev/sdd3
root@host:~# mdadm -a /dev/md1 /dev/sdc4 /dev/sdd4
root@host:~# mdadm --grow --raid-devices=4 /dev/md0
root@host:~# mdadm --grow --raid-devices=4 /dev/md1

Volg het proces met

watch cat /proc/mdstat 

Aan het einde van het proces laat de array de nieuwe omvang zien met

root@host:~# mdadm --detail /dev/md0
/dev/md0:
     Array Size : 37722624 (35.98 GiB 38.63 GB)
  Used Dev Size : 12574208 (11.99 GiB 12.88 GB)
   Raid Devices : 4
    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       2       8       19        1      active sync   /dev/sdb3
       3       8       35        2      active sync   /dev/sdc3
       4       8       51        3      active sync   /dev/sdd3
root@host:~# mdadm --detail /dev/md1
/dev/md1:
     Array Size : 668891136 (637.90 GiB 684.94 GB)
  Used Dev Size : 222963712 (212.63 GiB 228.31 GB)
   Raid Devices : 4
    Number   Major   Minor   RaidDevice State
       0       8        4        0      active sync   /dev/sda4
       2       8       20        1      active sync   /dev/sdb4
       3       8       36        2      active sync   /dev/sdc4
       4       8       52        3      active sync   /dev/sdd4

Of met:

root@host:~# array-info -a -d /dev/md0
MD Linux driver
Version 1.2.3
Creation time   : Sat Apr  2 17:19:25 2557

Fault tolerance : RAID 5
Array Size      : 35.98 GiB
Status          : Logical drive is ok
Devices         : 4
        Size    : 11.99 GiB
        Raid    : 4
        Active  : 4
        Working : 4
        Failed  : 0
        Spare   : 0
  RaidDevice   State
           0   active synchronized 
          -1   removed 
           1   active synchronized 
           2   active synchronized 
root@host:/etc/mdadm# array-info -a -d /dev/md1
MD Linux driver
Version 1.2.3
Creation time   : Sat Apr  2 17:20:06 2557

Fault tolerance : RAID 5
Array Size      : 637.90 GiB
Status          : Logical drive is ok
Devices         : 4
        Size    : 212.63 GiB
        Raid    : 4
        Active  : 4
        Working : 4
        Failed  : 0
        Spare   : 0
  RaidDevice   State
           0   active synchronized 
          -1   removed 
           1   active synchronized 
           3   active synchronized 
root@host:/etc/mdadm#

Extra ruimte array toekennen

De nieuwe extra ruimte is nog niet beschikbaar voor het physical volume op de array, toekennen gaat met pvresize.

root@host:~# pvscan
  PV /dev/sdc5   VG kvm-swap   lvm2 [8.00 GiB / 7.12 GiB free]
  PV /dev/md1    VG kvm-data   lvm2 [212.63 GiB / 198.63 GiB free]
  PV /dev/md0    VG kvm-root   lvm2 [11.99 GiB / 3.99 GiB free]
  Total: 3 [232.62 GiB] / in use: 3 [232.62 GiB] / in no VG: 0 [0   ]
root@host:~# pvresize /dev/md0
  Physical volume "/dev/md0" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
root@host:~# pvresize /dev/md1
root@host:~# mdadm --detail /dev/md1
  Physical volume "/dev/md1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
root@host:~# pvscan
  PV /dev/sdc5   VG kvm-swap   lvm2 [8.00 GiB / 7.12 GiB free]
  PV /dev/md1    VG kvm-data   lvm2 [637.90 GiB / 623.90 GiB free]
  PV /dev/md0    VG kvm-root   lvm2 [35.97 GiB / 27.97 GiB free]
  Total: 3 [681.87 GiB] / in use: 3 [681.87 GiB] / in no VG: 0 [0   ]
root@host:~#

Terug naar: Webhuis bouwstenen