Ir al contenido

Gestión de discos/volúmenes adicionales

Christophe TREMBLAY-GUILLOUX
Christophe TREMBLAY-GUILLOUXIngeniero de sistemas Linux

Primero, detén algunos servicios y desmonta el disco con el script :

Sección titulada «Primero, detén algunos servicios y desmonta el disco con el script :»
bash
mount-backup-disk.sh umount

Aparece algo parecido a esto:

>> désactivation de l'agent Puppet
>> suspension des planifs
Updated scheduled backup xxx
disable xxx
>> arrêt de Webmin
>> démontage des binds
umount /home/xxx/virtualmin-backup
...
>> démontage du disque /var/backups/home
OK. Disque démonté. Pour remonter : /usr/local/bin/mount-backup-disk.sh remount

Cambia la configuración Terraform del proyecto Public Cloud a gestionar :

Sección titulada «Cambia la configuración Terraform del proyecto Public Cloud a gestionar :»
  1. Prepara la actualización del archivo resource-openstack-compute-instance-xxx.tf modificando esta sección y el parámetro size:
resource "openstack_blockstorage_volume_v3" "xxx_data" {
provider = openstack.ovh
region = "GRA9"
name = "xxx_data"
size = 100
enable_online_resize = true
lifecycle {
prevent_destroy = true
}
}
  1. Prepara el plan de actualización:
bash
terraform plan -var-file=prod.tfvars -out plan.zip

Se ve algo de este estilo:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# openstack_blockstorage_volume_v3.xxx_data will be updated in-place
~ resource "openstack_blockstorage_volume_v3" "xxx_data" {
id = "xxx"
name = "xxx_data"
~ size = 40 -> 100
# (10 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
───────────────────────────────────────
Saved the plan to: plan.zip
To perform exactly these actions, run the following command to apply:
terraform apply "plan.zip"
  1. Comprueba el plan:
bash
terraform show plan.zip

Verifica en la salida que nada indica un destroy, solo update in-place en color naranja:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# openstack_blockstorage_volume_v3.xxx_data will be updated in-place
~ resource "openstack_blockstorage_volume_v3" "xxx_data" {
id = "xxx"
name = "xxx_data"
~ size = 40 -> 100
# (10 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
  1. Aplica el plan:
bash
terraform apply -var-file=prod.tfvars planDANGER.zip

Al cabo de unos instantes:

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Se fuerza la detección del disco que vuelve y se corrige la tabla GPT:

bash
partrprobe
parted /dev/sdb

Se usan estos comandos en el prompt de parted para ampliar la partición:

(parted) print
Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of
the space (an extra xxx blocks) or continue with the current setting?
Fix/Ignore? F
...
(parted) resizepart 1 100%
(parted) quit

Volver a montar el sistema y ampliar el sistema de archivos

Sección titulada «Volver a montar el sistema y ampliar el sistema de archivos»

Si el sistema de archivos es ext4, se amplía antes de volver a montarlo; si no, después:

bash
mount-backup-disk.sh remount
bash
e2fsck -f /dev/sdxy
resize2fs /dev/sdxy
mount /mount/point
bash
btrfs filesystem resize max /var/backups/home
bash
xfs_growfs /var/backups/home