OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Automatic Block storage backup - how?


#1

The workflow management permits to schedule backups of a cloud instance. What about the same for Block storage? I can only see a manuel backup possibility.


#2

I have the same problematic, anyone can help us ? Please


#3

Hi @Los & @FabianV

As far as I understand you must program it in a bash script or your control panel must have the option to do it by linking the Backup Storage accesses provided by OVH

Regards,


#4

Hi,

The usual issue with block storage is the fact it is best to detach the volume from the instance before doing backup of it. Having said that if we were just to detach the disk from the instance for a snapshot, that can cause some issue also. It is best that the volume is unmounted from the operating system level first before doing it on OpenStack level. Then once the disk is detached you can do a backup.

Why detaching before backup is ideal? Well, when you snapshot a instance, the host sends a filesystem freeze signal to the guest operating system (your instance) via the QEMU Guest Agent. This ensures consistency and integrity of your data during the backup. Once it is done, the host sends to the guest OS signal that it can unfreeze the filesystem. This mechanism does not exist when you are backing up the volume. Which is why it is better to detach first so that you can ensure you have consistency and integrity of your data during the backup (no writes happening to the disk during backup).

Since OVHcloud does not have access to customers instances to unmount the volume on the operating system level, it is not ideal for us to detach the volume as it is not a clean way. It would be like removing a disk from a server while it is running and it is not a raid. Any application that uses it could have issues since the disk would just would disappear.

You can force a backup of the volume when it is in use. It is personal choice if you want to or not. https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-backups.html

You can automate it with something like cron job that executes a script. The script could either the OpenStack API or the OVH API.

  1. On the instance you should umount the volume first (operating system level)
  2. Once that is done, you can detach the volume:
    OpenStack API: openstack server remove volume
    OVH API: https://api.ovh.com/console/#/cloud/project/{serviceName}/volume/{volumeId}/detach#POST
  3. Start the backup:
    OpenStack API: openstack volume backup create --name
    OVH API: https://api.ovh.com/console/#/cloud/project/{serviceName}/volume/{volumeId}/snapshot#POST
  4. Attach the volume back to the instance
    OpenStack API: openstack server add volume
    OVH API: https://api.ovh.com/console/#/cloud/project/{serviceName}/volume/{volumeId}/attach#POST
  5. Mount the volume again on the operating system level

Question on Block Storage Snapshots utility
#5

Hello,

Thank you @AdamO for your answer.

I created a bash script able to make backups and/or snapshots through a third party block storage that I synchronize. My script avoids detaching and backing up a block storage during its use and also avoids heavy performance loss through synchronization.

I plan to comment it and share it in the next few days to the community and on Github.

Don’t hesitate to contact me if you want to talk about it or need me to share it in the meantime.

Los


#6

In the context of the SBG fire: this “backup” step is it only a snapshot, or is it a proper backup like and instance backup to different storage?


#7

Hi Los,
I’m interested in your script :wink:
Did you share it somewhere?
Thank you!


#8

Hi, I didn’t take a moment to do it, I have to explain the script. I try to do it today.


#9

This is the repository of my script :

Don’t hesitate to contact me if you have questions. I will complete the read me.


#10

Thank you very much! It looks great, I will look further into it when I get some time.