User Tools

Site Tools


doc:appunti:linux:sa:raid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:raid [2019/11/22 09:35] – [Cambiare dimensione a una partizione ext3] niccolodoc:appunti:linux:sa:raid [2024/04/17 10:44] (current) – [Gestione RAID con mdadm] niccolo
Line 6: Line 6:
  
 Vedere la pagina **[[resize2fs]]**. Vedere la pagina **[[resize2fs]]**.
 +
 ===== Parametri Boot (per GRUB o LILO) relativi al RAID ===== ===== Parametri Boot (per GRUB o LILO) relativi al RAID =====
  
Line 14: Line 15:
 </code> </code>
  
-===== Gestione volumi RAID =====+===== Gestione RAID con mdadm =====
  
-==== Utilizzo di mdadm ====+=== Creazione di un volume RAID1 ===
  
-Invece dei vecchi raidtools si usa il nuovo ''mdadm''.+Con il comando seguente viene creato e immediatamente attivato un volume **RAID1** in modalità **degradata**, cioè con un solo disco attivo: 
 + 
 +<code> 
 +mdadm --create /dev/md10 --run --level=1 --raid-devices=2 /dev/sdb3 missing 
 +</code>
  
 === Aggiungere una partizione ad un volume RAID === === Aggiungere una partizione ad un volume RAID ===
 +
 +Per aggiungere un componente ad un volume RAID, ad esempio per ripristinare un volume degradato:
  
 <code> <code>
Line 26: Line 33:
 </code> </code>
  
 +=== Avviare un volume in modalità degradata ===
  
 +Se non è possibile montare un volume RAID nella sua completezza (ad esempio perché un componente di un RAID1 è guasto), il volume non viene attivato automaticamente. Per forzare l'operazione è necessario passare il parametro **%%--run%%**.
  
 +**ATTENZIONE**! Senza il parametro ''%%--run%%'' il volume viene assemblato (con un nome di device assegnato automaticamente, in generale non con quello richiesto), ma non viene avviato. Il contenuto del volume non è quindi leggibile e il volume appare vuoto.
  
 +<code>
 +mdadm /dev/md17 --assemble /dev/sdc7 --run
 +</code>
  
 +=== Rimuovere un componente da un volume RAID ===
  
 +Per rimuovere un componente, ad esempio da un volume RAID1, è necessario prima marcarlo come guasto (fail), dopo sarà possibile rimuoverlo dal RAID, che continuerà a lavorare in modalità degradata:
 +
 +<code>
 +mdadm --manage /dev/md0 --fail /dev/sdb2
 +mdadm --manage /dev/md0 --remove /dev/sdb2
 +</code>
 +
 +=== Distruggere un volume RAID ===
 +
 +Per eliminare definitivamente un volume raid è necessario fermarlo, quindi è opportuno azzerare il sperblock di ogni componente, per evitare che l'auto-run dei volumi trovi la signature nelle partizioni e provveda a fare l'assemblaggio al successivo reboot:
 +
 +<code>
 +mdadm --stop /dev/md4
 +mdadm --zero-superblock /dev/sda7
 +mdadm --zero-superblock /dev/sdb7
 +</code>
  
  
Line 162: Line 192:
  
 which actually does not run the array if it is degraded (where the previous start was not). which actually does not run the array if it is degraded (where the previous start was not).
 +
 +==== Rename an MD device permanently ====
 +
 +To geneate the configuration file **/etc/mdadm/mdadm.conf** you can use the tool **/usr/share/mdadm/mkconf**, which gathers information from the existing RAID volumes. The information are read from the **superblock** of the MD arrays and contains the **name** and **homehost**, so the file created contains lines like this:
 +
 +<file>
 +ARRAY /dev/md/125  metadata=1.2 UUID=d92a8066:fc45b7d3:f916e674:3a695968 name=hostname:125
 +</file>
 +
 +Editing ''mdadm.conf'' to rename a device (e.g. changing from **/dev/md/125** to **/dev/md/5**) will work on the next reboot (remember to update initramfs), but eventually ''mkconf'' will restore the name ''/dev/md/125'' on the next run. To change the name permanently you have to stop the RAID device and update the superblock:
 +
 +<code>
 +mdadm --stop /dev/md/125
 +mdadm --assemble /dev/md/5 --name=5 --homehost=newhostname --update=name /dev/sda5 /dev/sdb5
 +</code>
  
 ===== Filesystem has unsupported feature(s) ===== ===== Filesystem has unsupported feature(s) =====
doc/appunti/linux/sa/raid.1574415352.txt.gz · Last modified: 2019/11/22 09:35 by niccolo