Creating backup plans
You can schedule an automatic backup job for multiple volumes by creating a backup plan. A backup plan defines the backup schedule and retention policy that are applied to all backups created by this plan.
Prerequisites
- The backup service is enabled in the command-line interface, as described in Provisioning the backup service.
To create a backup plan
Admin panel
- On the Compute > Backup > Backup plans tab, click Create backup plan.
-
In the Create backup plan window, specify a name for the backup plan and, optionally, a description.
A description should not contain any personally identifiable information or sensitive business data.
- In What to back up, click Manage. In the Manage volumes window, select compute volumes that will be included in the backup plan, and then click Save.
-
In Schedule, select the schedule for the backup plan:
- Select Retention 7 days to create a backup of the selected volumes every day and keep each backup for seven days.
- Select Retention 14 days to create a backup of the selected volumes every day and keep each backup for 14 days.
- Select Custom to configure a custom schedule for the automatic backup. You can choose months, days of the week, days of the month, time, and the maximum number of recovery points to keep.
- Click Create.
Command-line interface
-
Create a backup plan by using the following command:
vinfra service compute backup-plan create [--description <description>] [--schedule-minute <minutes>] [--schedule-hour <hours>] [--schedule-day <days>] [--schedule-day-of-week <days-of-week>] [--schedule-week <weeks>] [--schedule-month <months>] [--schedule-interval <interval>] [--schedule-disable] [--recovery-points-rotation <amount>] [--disabled] [--enabled] <backup-plan-name>
<backup-plan-name>
- Backup plan name
--description <description>
- Backup plan description
--schedule-minute <minutes>
- Comma-separated list of minutes. Specify
'*'
to schedule backup every minute. --schedule-hour <hours>
- Comma-separated list of hours. Specify
'*'
to schedule backup every hour. --schedule-day <days>
- Comma-separated list of days of the month. Specify
'*'
to schedule backup every day. --schedule-day-of-week <days-of-week>
- Comma-separated list of days of the week. Specify
'*'
to schedule backup every week day. --schedule-week <weeks>
- Comma-separated list of weeks. Specify
'*'
to schedule backup every week. --schedule-month <months>
- Comma-separated list of months. Specify
'*'
to schedule backup every mouth. --schedule-interval <interval>
- Interval between backups, in hours. You can also specify the following units:
h
for hours,d
for days, andw
for weeks. Only one unit can be used at a time. --schedule-disable
- Erase backup schedule.
--recovery-points-rotation <amount>
- Amount of full recovery points to preserve.
--disabled
- Disable backup plan.
--enabled
- Enable backup plan.
For example, to create the backup plan
myplan
, schedule it to run every day, and set the maximum recovery points to 5, run:# vinfra service compute backup-plan create myplan --schedule-day '*' --recovery-points-rotation 5
You can check the backup plan details in the
vinfra service compute backup-plan show
output:# vinfra service compute backup-plan show myplan +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | created_at | 2024-03-13T15:30:27.473014 | | description | | | disabled | False | | domain_id | default | | ended_at | | | id | bc9b9edc5ae346e1b49614a9cb0c3cdb | | name | myplan | | project_id | 70eff98528054d0b95a8936bfa4aa2a3 | | properties | recovery_points_rotation: 5 | | schedule | day: '*' | | started_at | | | status | scheduled | | updated_at | 2024-03-13T15:32:49.648791 | +-------------+----------------------------------+
-
Find out the IDs of volumes in your compute cluster by running:
# vinfra service compute volume list +--------------------------------------+------------------------+------+--------+------------------------------------------+ | id | name | size | status | os-vol-host-attr:host | +--------------------------------------+------------------------+------+--------+------------------------------------------+ | 5a66c317-a218-4963-9f3e-d8f459e3d343 | vm1/cirros/Boot volume | 1 | in-use | node001.vstoragedomain@vstorage#vstorage | +--------------------------------------+------------------------+------+--------+------------------------------------------+
-
Add volumes that you want to back up to the backup plan by using the following command:
vinfra service compute backup-plan volume add <backup-plan> [<backup-plan-volume> ...]
<backup-plan>
- Backup plan ID or name
<backup-plan-volume>
- Volume ID
For example, to add the volume with the ID
5a66c317-a218-4963-9f3e-d8f459e3d343
to the backup planmyplan
, run:# vinfra service compute backup-plan volume add myplan 5a66c317-a218-4963-9f3e-d8f459e3d343
The added volume will appear in the
vinfra service compute backup-plan volume list
output:# vinfra service compute backup-plan volume list myplan +-------------+------------------------+------+-----------+----------------------------------+---------------------+ | id | name | size | status | project_id | storage_policy_name | +-------------+------------------------+------+-----------+----------------------------------+---------------------+ | 5a66c317<…> | vm1/cirros/Boot volume | 1 | in-use | d0460058ccc04936b81b0653e490a121 | default | +-------------+------------------------+------+-----------+----------------------------------+---------------------+