Managing extra disks/volumes
Growing a virtual disk
Section titled “Growing a virtual disk”First, stop a few services and unmount the disk with the script :
Section titled “First, stop a few services and unmount the disk with the script :”mount-backup-disk.sh umountSomething like this appears:
>> désactivation de l'agent Puppet>> suspension des planifsUpdated scheduled backup xxx disable xxx>> arrêt de Webmin>> démontage des binds umount /home/xxx/virtualmin-backup ...>> démontage du disque /var/backups/homeOK. Disque démonté. Pour remonter : /usr/local/bin/mount-backup-disk.sh remountChange the Terraform configuration of the Public Cloud project to manage :
Section titled “Change the Terraform configuration of the Public Cloud project to manage :”OVH Public Cloud
Section titled “OVH Public Cloud”- Prepare the update of the resource-openstack-compute-instance-xxx.tf file by changing this section and the size parameter:
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 }}- Prepare the update plan:
terraform plan -var-file=prod.tfvars -out plan.zipYou get something along these lines:
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"- Check the plan:
terraform show plan.zipCheck in the output that nothing mentions a destroy, only update in-place in orange:
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.- Apply the plan:
terraform apply -var-file=prod.tfvars planDANGER.zipAfter a few moments:
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.Growing the partition table
Section titled “Growing the partition table”Force the detection of the returning disk and fix the GPT table:
partrprobeparted /dev/sdbUse these commands at the parted prompt to grow the partition:
(parted) printWarning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all ofthe space (an extra xxx blocks) or continue with the current setting?Fix/Ignore? F...(parted) resizepart 1 100%(parted) quitRemounting the system and growing the file system
Section titled “Remounting the system and growing the file system”If the file system is ext4, grow it before remounting, otherwise afterwards:
mount-backup-disk.sh remountExt4 case
Section titled “Ext4 case”e2fsck -f /dev/sdxyresize2fs /dev/sdxymount /mount/pointBTRFS case (online)
Section titled “BTRFS case (online)”btrfs filesystem resize max /var/backups/homeXFS case (online)
Section titled “XFS case (online)”xfs_growfs /var/backups/homeSee also
Section titled “See also”- Rebooting an OVH VPS in rescue mode, if the server does not boot after the operation.
- Virtualmin on the command line, for the server administration commands.
