informatica:microservers
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| informatica:microservers [2020/09/14 14:03] – jose | informatica:microservers [2020/12/16 00:15] (current) – jose | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| + | ===== Poner IP fija: ===== | ||
| + | / | ||
| + | < | ||
| + | allow-hotplug eno1 | ||
| + | iface eno1 inet static | ||
| + | address 192.168.1.76 | ||
| + | netmask 255.255.255.0 | ||
| + | gateway 192.168.1.1 | ||
| + | dns-nameservers 192.168.1.1 8.8.8.8 8.8.4.4 | ||
| + | </ | ||
| ====== ILO ====== | ====== ILO ====== | ||
| Line 103: | Line 113: | ||
| {{: | {{: | ||
| + | |||
| + | ===== Configuración del RAID ===== | ||
| + | ==== Formatear los discos ==== | ||
| + | Vemos como están las particiones: | ||
| + | fdisk -l | ||
| + | |||
| + | < | ||
| + | Disk /dev/sda: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors | ||
| + | Disk model: ST8000DM004-2CX1 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: gpt | ||
| + | Disk identifier: 02ED88CD-1EBC-445B-89DB-6522BEB7EA03 | ||
| + | |||
| + | Device | ||
| + | / | ||
| + | |||
| + | </ | ||
| + | < | ||
| + | |||
| + | Disk /dev/sdc: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors | ||
| + | Disk model: ST8000DM004-2CX1 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | |||
| + | |||
| + | </ | ||
| + | < | ||
| + | Disk /dev/sde: 111.8 GiB, 120034123776 bytes, 234441648 sectors | ||
| + | Disk model: KINGSTON SA400S3 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: dos | ||
| + | Disk identifier: 0x57311578 | ||
| + | |||
| + | Device | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | |||
| + | |||
| + | </ | ||
| + | < | ||
| + | Disk /dev/sdd: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors | ||
| + | Disk model: ST8000DM004-2CX1 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | |||
| + | |||
| + | </ | ||
| + | < | ||
| + | Disk /dev/sdb: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors | ||
| + | Disk model: ST8000DM004-2CX1 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | |||
| + | |||
| + | </ | ||
| + | < | ||
| + | Disk /dev/sdf: 29.3 GiB, 31444697088 bytes, 61415424 sectors | ||
| + | Disk model: Internal SD-CARD | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: dos | ||
| + | Disk identifier: 0xeefb95d3 | ||
| + | |||
| + | Device | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Tenemos 4 discos de 8Tb Tenemos que poner label GPT y crear una partición como linux raid | ||
| + | |||
| + | Creamos label GPT seleccionando g: | ||
| + | fdisk /dev/sda | ||
| + | < | ||
| + | Command (m for help): g | ||
| + | Created a new GPT disklabel (GUID: 99B4091D-BC19-D542-9331-B99666D7F464). | ||
| + | The old dos signature will be removed by a write command. | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | Ahora creamos la partición y luego modificamos a LINUX RAID | ||
| + | root@nas:~# fdisk /dev/sda | ||
| + | < | ||
| + | Welcome to fdisk (util-linux 2.33.1). | ||
| + | Changes will remain in memory only, until you decide to write them. | ||
| + | Be careful before using the write command. | ||
| + | |||
| + | |||
| + | Command (m for help): p | ||
| + | Disk /dev/sdd: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors | ||
| + | Disk model: ST8000DM004-2CX1 | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: gpt | ||
| + | Disk identifier: 99B4091D-BC19-D542-9331-B99666D7F464 | ||
| + | |||
| + | Command (m for help): n | ||
| + | Partition number (1-128, default 1): | ||
| + | First sector (2048-15628053134, | ||
| + | Last sector, +/-sectors or +/ | ||
| + | |||
| + | Created a new partition 1 of type 'Linux filesystem' | ||
| + | |||
| + | Command (m for help): t | ||
| + | Selected partition 1 | ||
| + | Partition type (type L to list all types): 29 | ||
| + | Changed type of partition 'Linux filesystem' | ||
| + | |||
| + | Command (m for help): w | ||
| + | The partition table has been altered. | ||
| + | Calling ioctl() to re-read partition table. | ||
| + | Syncing disks. | ||
| + | </ | ||
| + | |||
| + | Nos tienen que quedar así: | ||
| + | root@nas:~# blkid | ||
| + | < | ||
| + | /dev/sde1: UUID=" | ||
| + | /dev/sde5: UUID=" | ||
| + | /dev/sda1: UUID=" | ||
| + | /dev/sdb1: UUID=" | ||
| + | /dev/sdc1: UUID=" | ||
| + | /dev/sdd1: UUID=" | ||
| + | /dev/sdf1: LABEL=" | ||
| + | </ | ||
| + | |||
| + | ==== Crear el RAID ==== | ||
| + | En este caso ya teníamos un RAID y primero hay que borrarlo porque se queda colgado: | ||
| + | root@nas:~# cat / | ||
| + | < | ||
| + | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] | ||
| + | md127 : inactive sda1[0](S) | ||
| + | 7813893447 blocks super 1.2 | ||
| + | |||
| + | unused devices: < | ||
| + | </ | ||
| + | |||
| + | Lo borramos: | ||
| + | root@nas: | ||
| + | mdadm: stopped /dev/md127 | ||
| + | Ahora si lo podemos crear: | ||
| + | root@nas:~# mdadm --create --verbose /dev/md0 --raid-devices=4 --level=raid5 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 | ||
| + | |||
| + | < | ||
| + | mdadm: layout defaults to left-symmetric | ||
| + | mdadm: layout defaults to left-symmetric | ||
| + | mdadm: chunk size defaults to 512K | ||
| + | mdadm: /dev/sda1 appears to be part of a raid array: | ||
| + | | ||
| + | mdadm: size set to 7813893120K | ||
| + | mdadm: automatically enabling write-intent bitmap on large array | ||
| + | Continue creating array? y | ||
| + | mdadm: Defaulting to version 1.2 metadata | ||
| + | mdadm: array /dev/md0 started. | ||
| + | </ | ||
| + | |||
| + | |||
| + | Montamos el RAID por UUID | ||
| + | blkid | ||
| + | |||
| + | < | ||
| + | /dev/md0: UUID=" | ||
| + | /dev/sda1: UUID=" | ||
| + | /dev/sdb1: UUID=" | ||
| + | /dev/sdc1: UUID=" | ||
| + | /dev/sde1: UUID=" | ||
| + | /dev/sde5: UUID=" | ||
| + | /dev/sdd1: UUID=" | ||
| + | /dev/sdf1: PARTUUID=" | ||
| + | /dev/sdf2: LABEL=" | ||
| + | </ | ||
| + | |||
| + | Ponemos en /etc/fstab | ||
| + | UUID=955edf36-f785-441e-95e6-ff7cd77fc510 / | ||
| + | |||
| Desde 192.168.1.32 | Desde 192.168.1.32 | ||
| Line 114: | Line 312: | ||
| mkdir /nfs | mkdir /nfs | ||
| mount 192.168.1.250:/ | mount 192.168.1.250:/ | ||
| + | root@nas:/ | ||
| + | |||
| + | root@nas:/ | ||
| + | / | ||
| + | |||
| + | |||
| + | |||
| + | Reiniciamos el servicio | ||
| + | root@nas:/ | ||
| + | exporting 192.168.1.0/ | ||
| + | |||
| + | |||
| + | En el cliente instalamos nfs: | ||
| + | apt-get install nfs-common | ||
| + | |||
| + | Mostramos si lo ve | ||
| + | root@avtp239: | ||
| + | Export list for 192.168.1.250: | ||
| + | / | ||
| + | |||
| + | Lo montamos | ||
| + | root@avtp239:/ | ||
| + | |||
| + | |||
| + | ===== Pruebas de recuperación ===== | ||
| + | ===== Recuperación Sistema Operativo ===== | ||
| + | El disco de arranque es un disco sólido de 120Gb | ||
| + | |||
| + | El disco de recuperación es una microsd de 32Gb colocada internamente. | ||
| + | |||
| + | Formateamos la microsd con el LABEL: REAR-0000. Buscamos que disco es: | ||
| + | fdisk -l | ||
| + | < | ||
| + | Disk /dev/sda: 29.3 GiB, 31444697088 bytes, 61415424 sectors | ||
| + | Disk model: Internal SD-CARD | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: dos | ||
| + | Disk identifier: 0xffbcc21c | ||
| + | |||
| + | Device | ||
| + | / | ||
| + | |||
| + | </ | ||
| + | |||
| + | Lo formateamos: | ||
| + | rear format /dev/sda | ||
| + | |||
| + | USB device /dev/sda is not formatted with ext2/3/4 or btrfs filesystem | ||
| + | Type exactly ' | ||
| + | (default ' | ||
| + | |||
| + | Yes | ||
| + | |||
| + | Vemos que lo ha creado correctamente: | ||
| + | blkid | ||
| + | /dev/sda1: LABEL=" | ||
| + | |||
| + | Vemos que está vacia | ||
| + | mount /dev/sda1 / | ||
| + | ls / | ||
| + | |||
| + | lost+found | ||
| + | |||
| + | Instalamos rear | ||
| + | apt-get install rear | ||
| + | Configuramos y excluimos la particion de /mnt/raid: | ||
| + | / | ||
| + | |||
| + | < | ||
| + | ### write the rescue initramfs to USB and update the USB bootloader | ||
| + | OUTPUT=USB | ||
| + | ### create a backup using the internal NETFS method, using ' | ||
| + | BACKUP=NETFS | ||
| + | ### write both rescue image and backup to the device labeled REAR-000 | ||
| + | BACKUP_URL=usb:/// | ||
| + | </ | ||
| + | |||
| + | |||
| + | Creamos backup que tarda unos 4 minutos. Si hemos montado la tarjeta, hay que desmontarla, | ||
| + | rear -v mkbackup | ||
| + | < | ||
| + | Relax-and-Recover 2.4 / Git | ||
| + | Using log file: / | ||
| + | Using backup archive '/ | ||
| + | Creating disk layout | ||
| + | Using guessed bootloader ' | ||
| + | Creating root filesystem layout | ||
| + | Cannot include keyboard mappings (no keymaps default directory '' | ||
| + | Copying logfile / | ||
| + | Copying files and directories | ||
| + | Copying binaries and libraries | ||
| + | Copying kernel modules | ||
| + | Copying all files in / | ||
| + | Creating recovery/ | ||
| + | Created initrd.cgz with gzip default compression (67642238 bytes) in 17 seconds | ||
| + | Saved / | ||
| + | Copying resulting files to usb location | ||
| + | Saving / | ||
| + | Creating tar archive '/ | ||
| + | Archived 529 MiB [avg 5263 KiB/sec] OK | ||
| + | Archived 529 MiB in 104 seconds [avg 5212 KiB/sec] | ||
| + | Exiting rear mkbackup (PID 1753) and its descendant processes | ||
| + | Running exit tasks | ||
| + | </ | ||
| + | |||
| + | Vemos que ha escrito en la tarjeta: | ||
| + | < | ||
| + | lost+found | ||
| + | boot | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | boot/ | ||
| + | rear | ||
| + | rear/ | ||
| + | rear/nas | ||
| + | rear/ | ||
| + | rear/ | ||
| + | rear/ | ||
| + | rear/ | ||
| + | rear/ | ||
| + | rear/ | ||
| + | rear/ | ||
| + | nas | ||
| + | nas/ | ||
| + | nas/ | ||
| + | nas/VERSION | ||
| + | nas/README | ||
| + | |||
| + | </ | ||
| + | |||
| + | Reiniciamos y arrancamos desde la tarjeta pulsando F11: | ||
| + | {{: | ||
| + | |||
| + | Seleccionamos la microsd, opción 3 | ||
| + | {{: | ||
| + | |||
| + | Subimos en el menu de grub y seleccionamos Recovery images, en nuestro caso nas: | ||
| + | {{: | ||
| + | |||
| + | Seleccionamos el backup que nos interese si hay varios: | ||
| + | {{: | ||
| + | |||
| + | Cuando nos salga la pantalla de login, ponemos root (no nos pedirá contraseña) y luego rear recover | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Pulsamos siempre 1) por defecto en todas las preguntas, al no ser que queremos hacer algún cambio, como los layouts, por si el disco destino es mas pequeño de tamaño. | ||
| + | |||
| + | Tarda un minuto | ||
| + | |||
| + | Cuando acabe, reiniciamos y ya lo tenemos recuperado. | ||
| + | |||
| + | ===== Recuperación Raid ===== | ||
| + | Tenemos 4 discos en RAID 5. | ||
| + | |||
| + | Miramos los discos que hay: | ||
| + | cat / | ||
| + | |||
| + | < | ||
| + | Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] | ||
| + | md0 : active raid5 sdb1[2] sda1[0] sdc1[1] sdd1[3] | ||
| + | 23441679360 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU] | ||
| + | [> | ||
| + | bitmap: 58/59 pages [232KB], 65536KB chunk | ||
| + | |||
| + | unused devices: < | ||
| + | </ | ||
| + | |||
| + | Mas detalle: | ||
| + | mdadm --detail /dev/md0 | ||
| + | < | ||
| + | /dev/md0: | ||
| + | | ||
| + | | ||
| + | Raid Level : raid5 | ||
| + | Array Size : 23441679360 (22355.73 GiB 24004.28 GB) | ||
| + | Used Dev Size : 7813893120 (7451.91 GiB 8001.43 GB) | ||
| + | Raid Devices : 4 | ||
| + | Total Devices : 4 | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | State : active, resyncing | ||
| + | Active Devices : 4 | ||
| + | | ||
| + | Failed Devices : 0 | ||
| + | Spare Devices : 0 | ||
| + | |||
| + | Layout : left-symmetric | ||
| + | Chunk Size : 512K | ||
| + | |||
| + | Consistency Policy : bitmap | ||
| + | |||
| + | | ||
| + | |||
| + | Name : nas:0 (local to host nas) | ||
| + | UUID : ba93d654: | ||
| + | Events : 3722 | ||
| + | |||
| + | Number | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | Quitamos un disco a saco como si fallara: | ||
| + | cat / | ||
| + | < | ||
| + | Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] | ||
| + | md0 : active raid5 sdb1[2] sda1[0] sdc1[1] | ||
| + | 23441679360 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_] | ||
| + | bitmap: 58/59 pages [232KB], 65536KB chunk | ||
| + | |||
| + | unused devices: < | ||
| + | </ | ||
| + | |||
| + | mdadm --detail /dev/md0 | ||
| + | < | ||
| + | /dev/md0: | ||
| + | | ||
| + | | ||
| + | Raid Level : raid5 | ||
| + | Array Size : 23441679360 (22355.73 GiB 24004.28 GB) | ||
| + | Used Dev Size : 7813893120 (7451.91 GiB 8001.43 GB) | ||
| + | Raid Devices : 4 | ||
| + | Total Devices : 3 | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | State : clean, degraded | ||
| + | Active Devices : 3 | ||
| + | | ||
| + | Failed Devices : 0 | ||
| + | Spare Devices : 0 | ||
| + | |||
| + | Layout : left-symmetric | ||
| + | Chunk Size : 512K | ||
| + | |||
| + | Consistency Policy : bitmap | ||
| + | |||
| + | Name : nas:0 (local to host nas) | ||
| + | UUID : ba93d654: | ||
| + | Events : 4069 | ||
| + | |||
| + | Number | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Paramos el servidor y metemos el disco nuevo. Al arrancar está igual: | ||
| + | cat / | ||
| + | < | ||
| + | Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] | ||
| + | md0 : active raid5 sdb1[2] sda1[0] sdc1[1] | ||
| + | 23441679360 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_] | ||
| + | bitmap: 58/59 pages [232KB], 65536KB chunk | ||
| + | |||
| + | unused devices: < | ||
| + | </ | ||
| + | |||
| + | mdadm --detail /dev/md0 | ||
| + | < | ||
| + | /dev/md0: | ||
| + | | ||
| + | | ||
| + | Raid Level : raid5 | ||
| + | Array Size : 23441679360 (22355.73 GiB 24004.28 GB) | ||
| + | Used Dev Size : 7813893120 (7451.91 GiB 8001.43 GB) | ||
| + | Raid Devices : 4 | ||
| + | Total Devices : 3 | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | State : active, degraded | ||
| + | Active Devices : 3 | ||
| + | | ||
| + | Failed Devices : 0 | ||
| + | Spare Devices : 0 | ||
| + | |||
| + | Layout : left-symmetric | ||
| + | Chunk Size : 512K | ||
| + | |||
| + | Consistency Policy : bitmap | ||
| + | |||
| + | Name : nas:0 (local to host nas) | ||
| + | UUID : ba93d654: | ||
| + | Events : 4236 | ||
| + | |||
| + | Number | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Lo añadimos: | ||
| + | mdadm /dev/md0 -a /dev/sdd | ||
| + | mdadm: added /dev/sdd | ||
| + | |||
| + | Vemos que hace el rebuild: | ||
| + | mdadm --detail /dev/md0 | ||
| + | |||
| + | < | ||
| + | /dev/md0: | ||
| + | | ||
| + | | ||
| + | Raid Level : raid5 | ||
| + | Array Size : 23441679360 (22355.73 GiB 24004.28 GB) | ||
| + | Used Dev Size : 7813893120 (7451.91 GiB 8001.43 GB) | ||
| + | Raid Devices : 4 | ||
| + | Total Devices : 4 | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | State : active, degraded, recovering | ||
| + | Active Devices : 3 | ||
| + | | ||
| + | Failed Devices : 0 | ||
| + | Spare Devices : 1 | ||
| + | |||
| + | Layout : left-symmetric | ||
| + | Chunk Size : 512K | ||
| + | |||
| + | Consistency Policy : bitmap | ||
| + | |||
| + | Rebuild Status : 0% complete | ||
| + | |||
| + | Name : nas:0 (local to host nas) | ||
| + | UUID : ba93d654: | ||
| + | Events : 4454 | ||
| + | |||
| + | Number | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Al mirar el estado, indica que tardará 8.000 minutos (mas de 5 días) en sincronizar: | ||
| + | cat / | ||
| + | < | ||
| + | Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] | ||
| + | md0 : active raid5 sdd[4] sdb1[2] sda1[0] sdc1[1] | ||
| + | 23441679360 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_] | ||
| + | [> | ||
| + | bitmap: 58/59 pages [232KB], 65536KB chunk | ||
| + | |||
| + | unused devices: < | ||
| + | </ | ||
| + | |||
| + | |||
informatica/microservers.1600092199.txt.gz · Last modified: by jose
