Base de conocimientos · Servidores Dedicados " VPS
Gestión del software de Linux RAID (Part I)
Última actualización 2019-02-03
Gestión del software de Linux RAID (Part I)
|
Redundant Array of Independent Disks (RAID) es una tecnología de almacenamiento y virtualización que primero ganó la tracción a finales de los años ochenta. Combina múltiples unidades de disco físico en una unidad virtual lógica para mejorar el rendimiento y facilitar la redundancia. Los datos se distribuyen en las unidades dependiendo del punto de contacto;Nivel de RAID. Aunque no sea un sustituto de las copias de seguridad, los niveles de RAID pueden ayudar a mantener su sistema funcionando frente a problemas de hardware comunes como la pérdida de datos de fallos de disco o errores de lectura (sector).
RAID can be implemented and managed using “block” devices, which can be Software RAID (e.g. Linux Software RAID’s mdadm), Hardware RAID (i.e. dedicated hardware card), or FakeRAID (also called BIOS or Onboard RAID). This article will be focusing on the how-tos of Linux Software RAID and its management tool, mdadm. Linux Software RAID is a block device that can work on most other devices—SATA, USB, IDE, SCSI, or a combination of these. Note that the La capa RAID no toca la capa del sistema de archivos at all. Puede colocar un sistema de archivos en un dispositivo RAID, al igual que en cualquier otro dispositivo de bloque.
Cómo funcionan los dispositivos RAID de software Los dispositivos RAID de software deben ser vistos como discos ordinarios o particiones de disco. Pueden ser "construidos" de varios otros dispositivos de bloque. In a RAID implementation, there are spare disks or hot spares that do not take part in the RAID set until one of the active disks fail. Once a device failure is detected, that device is marked as ‘faulty’ and the set starts reconstruction immediately on the first hot spare available. Your system can now run for some time even with a faulty disk as the spare takes its place. If no spare disk is available, then the array runs in 'degraded' mode. Note that faulty disks still appear and behave as members of the array. The RAID layer just avoids reading/writing them. Also, if a device needs to be removed from the array, remember to mark it first as ‘faulty’ before you remove it.
Creación de un dispositivo RAID basado en la unidad SATA You can use full drives as parts of a RAID array but this should be avoided if you want to make the drives bootable. What you need to do is create a partition in the drives (using fdisk or Parted) with partition type set to ‘fd, Pulsquo; el software de Linux RAID auto-detecto. Después de crear una partición en cada unidad relevante (sda1, sdb1), ahora puede crear el array: mdadm --create /dev/md0 -n 2 --level=1 /dev/sda1 /dev/sdb1 Where:
NOTA IMPORTANTE: Si quieres arrancar desde un dispositivo RAID, coloca elcargador de arranque code at the start of the physical drive that will be used as the underlying component of the RAID device. This means that if you are using/dev/sda1" como miembro del array avecbsp;/dev/md0 and your primary HDD/SSD is set as Opción de arranque BIOS, you must choose /dev/sda for the cargador de arranque code. One way to do this is by running grub-install /dev/sda. Después de crear un dispositivo RAID, puede utilizarlo como lo haría una unidad local regular. Por ejemplo, puede utilizarlo como un volumen físico para el kernel de Linux, el administrador lógico del volumen (LVM) o poner un sistema de archivos en él.
Mientras que los metadatos RAID se almacenan en cada unidad de componente, todavía debe guardar su configuración RAID para su uso futuro. Esto le ayudará a monitorizar y corregir el nombre de dispositivo md, de lo contrario obtendrás nombres de dispositivos como md126 y md127. Puede guardar su archivo de configuración ejecutando el siguiente comando:
Para Ubuntu:
Monitorear un dispositivo RAID Puede monitorear proactivamente la salud de un dispositivo RAID usando simultáneamentebsp;--monitor in the mdadm tool. If mdadm detects an array health issue, it can do a host of actions you specify in the command line. It can send an email, run a specified program, or send a message to the system log to name a few. Read the manual in hombre mdadm (Monitor section) to see a list of options. Most Linux distributions provide wrappers for the mdadm –monitor. CentOS / RHEL for example, provides an mdmonitor service, which you can set to start automatically with the system by running chkconfig mdmonitor en. Otra manera de comprobar la salud del dispositivo es mirar hacia el lado positivo;/proc/mdstat text file para ver qué arrays reconoce y ve su kernel para ver sus respectivos estados.
Reemplazando la unidad de componente de un dispositivo RAID Para reemplazar una unidad (por ejemplo (/dev/sdb1) in an active RAID array, it first needs to marked as ‘faulty’ by the kernel—marked as (F) in the /proc/mdstat. If it is not yet marked as faulty, you must do the tagging yourself prior to removal. To do this, run mdadm /dev/md0 -f /dev/sdb1.
Después de que se retira la unidad, puede añadir otra unidad como reemplazo usando Pulsbsp;mdadm /dev/md0 -a /dev/sdc1. Note that you can perform multiple operations with this one command—e.g. mdadm /dev/md0 -f /dev/sdb1 -r /dev/sdb1 -a /dev/sdc1.
Revise el contenido del corpiño;/proc/mdstat file después para ver si todo fue como se esperaba. La operación fue como debería si mdadm no producira ningún error de salida durante el reemplazo.
Destruir un dispositivo RAID Puede haber un tiempo cuando necesite destruir completamente un dispositivo RAID para hacer que los dispositivos subyacentes sean utilizables para el sistema. Una situación en la que esto es plausible es si tienes un HDD de repuesto con metadatos RAID preconfigurados y tu kernel reconoce el array. En este caso, sólo hay un miembro en el array y no es posible simplemente quitar el único disco. Para destruir el dispositivo RAID, primero necesitas detener el array con Pulsp;mdadm -S /dev/md0. The next step is to remove the metadata from the sda1 partition by issuing the command mdadm --zero-superblock /dev/sda1. Recuerde traer los metadatos/dev/sda1 (not /dev/sda) a cero (0) si es parte de un array.
Referencias: |
Dinos lo que necesitas
Compare los planes disponibles o describa su carga de trabajo para que podamos discutir un punto de partida adecuado.