Changing a disk snapshot schedule
Changing basic settings
To change basic settings of a disk snapshot schedule:
-
In the management console
, select the folder where the schedule is located. -
Select Compute Cloud.
-
In the left-hand panel, select
Snapshots. -
Go to the Snapshot schedules tab.
-
Next to the schedule you want to change, click
and select Edit. -
Edit disk snapshot schedule parameters:
-
Name. The naming requirements are as follows:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
-
Description.
-
Under Create snapshots, specify disk snapshot frequency:
By hour
,By day
,By week
, orBy cron expression
. You must specify the disk snapshot time for the UTC±00:00 time zone. -
In the Starting on field, set the start date for your schedule.
-
Select the disk snapshot retention policy:
- Store all snapshots: Enables retaining all the snapshots created by this schedule.
- Only the last: Specify the number of the most recent snapshots to retain or the number of days for which you want to retain the snapshots. Other snapshots created by this schedule will be deleted automatically.
Note
Quotas apply to the number and total amount of snapshots in the cloud.
-
-
Click Save.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
View the description of the CLI commands for managing schedules:
yc compute snapshot-schedule --help yc compute snapshot-schedule update --help
-
Get a list of schedules in the default folder:
yc compute snapshot-schedule list --format yaml
Result:
- id: fc852cvb1ipd5******** folder_id: e1ea8s8l71li******** created_at: "2022-09-28T13:25:02Z" ... expression: 10 19 ? * * snapshot_count: "7" snapshot_spec: {}
-
Update the parameters of the selected schedule:
yc compute snapshot-schedule update <schedule_name_or_ID> \ --new-name <new_schedule_name> \ --description <description> \ --expression <cron_expression> \ --retention-period <disk_snapshot_retention_period> \ --snapshot-count <number_of_disk_snapshots> \ --start-at <start_date_and_time> \ --labels <labels>
Where:
--new-name
: New name for the schedule.--description
: Description.--expression
: Cron expression.--retention-period
: Disk snapshot retention period in seconds (s
), minutes (m
), or hours (h
).--snapshot-count
: Number of stored disk snapshots. Use either--snapshot-count
or--retention-period
. See disk snapshot retention policies.--start-at
: Start date and time. You can also specify a period related to the current time point. For example:"2022-12-31T16:39:00+05:00"
,"2h"
.--labels
: List of labels inkey=value
format.
For more information about the
yc compute snapshot-schedule create
command, see the CLI reference.Result:
done (3s) id: fc8e52mvchb2******** folder_id: e1ea8s8l71li******** ... expression: 36 14 */1 * * snapshot_count: "3" snapshot_spec: {}
If you don't have Terraform, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and edit the fragment with the schedule description:
Sample schedule description in the Terraform configuration
resource "yandex_compute_snapshot_schedule" "default" { name = "my-name" schedule_policy { expression = "0 0 * * *" } snapshot_count = 1 snapshot_spec { description = "snapshot-description" labels = { snapshot-label = "my-snapshot-label-value" } } disk_ids = ["test_disk_id", "another_test_disk_id"] }
-
Apply the changes:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
-
You can check the schedule update and its new configuration using the management console
yc compute snapshot-schedule get <schedule_name>
-
Get the list of schedules using the list REST API method for the SnapshotSchedule resource or the SnapshotScheduleService/List gRPC API call.
You can create snapshots of network drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra-high performance network storages with three replicas (SSD).
For non-replicated SSDs and ultra-high performance network storages with three replicas (SSD), the snapshot time is not determined.
To take snapshots of local disks residing on dedicated hosts, use Yandex Cloud Backup. This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.
-
Update a disk snapshot schedule using the update REST API method for the
SnapshotSchedule
resource or the SnapshotScheduleService/Update gRPC API call.
Changing a disk list
To edit a list of disks for which snapshots are scheduled:
- In the management console
, select the folder where the schedule is located. - Select Compute Cloud.
- In the left-hand panel, select
Snapshots. - On the Snapshot schedules tab, choose a schedule for which you want to change a disk list.
- Change a disk list:
-
To add a new disk, under Disks, click
Add disk. In the window that opens, choose a disk to add to the schedule and click Save.You can create snapshots of network drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra-high performance network storages with three replicas (SSD).
For non-replicated SSDs and ultra-high performance network storages with three replicas (SSD), the snapshot time is not determined.
To take snapshots of local disks residing on dedicated hosts, use Yandex Cloud Backup. This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.
-
To delete a disk, under Disks, next to the disk you want to delete from the schedule, click
and select Delete from schedule.
-
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
Add or remove disks using the add-disks
and remove-disks
commands.
To add disks:
-
View the description of the CLI commands for managing schedules:
yc compute snapshot-schedule --help yc compute snapshot-schedule add-disks --help
-
Get a list of schedules in the default folder:
yc compute snapshot-schedule list --format yaml
Result:
- id: fc852cvb1ipd5******** folder_id: e1ea8s8l71li******** created_at: "2022-09-28T13:25:02Z" ... expression: 10 19 ? * * snapshot_count: "7" snapshot_spec: {}
-
To add disks to the schedule, get disk IDs:
yc compute disk list --format yaml
Result:
- id: epdcq9g3co9s******** folder_id: e1ea8s8l71li******** created_at: "2022-10-13T14:37:44Z" ... instance_ids: - fhm1c7u23aiq******** disk_placement_policy: {}
-
Add disks to the schedule:
yc compute snapshot-schedule add-disks <name_or_ID_of_the_schedule> \ --disk-id <ID_of_disk_1>,<ID_of_disk_2>
Result:
done (3s) id: fc8e52mvchb2******** folder_id: e1ea8s8l71li******** ... expression: 36 14 */1 * * snapshot_count: "3" snapshot_spec: {}
To delete disks:
-
View the description of the CLI commands for managing schedules:
yc compute snapshot-schedule --help yc compute snapshot-schedule remove-disks --help
-
Get a list of schedules in the default folder:
yc compute snapshot-schedule list --format yaml
Result:
- id: fc852cvb1ipd5******** folder_id: e1ea8s8l71li******** created_at: "2022-09-28T13:25:02Z" ... expression: 10 19 ? * * snapshot_count: "7" snapshot_spec: {}
-
Get a list of disks used in the current schedule:
yc compute snapshot-schedule list-disks <name_or_ID_of_the_schedule> \ --format yaml
Result:
- id: epdcq9g3co9s******** folder_id: e1ea8s8l71li******** created_at: "2022-10-13T14:37:44Z" ... instance_ids: - fhm1c7u23aiq******** disk_placement_policy: {}
-
Delete disks from the schedule:
yc compute snapshot-schedule remove-disks <name_or_ID_of_the_schedule> \ --disk-id <ID_of_disk_1>,<ID_of_disk_2>
Result:
done (3s) id: fc8e52mvchb2******** folder_id: e1ea8s8l71li******** ... expression: 36 14 */1 * * snapshot_count: "3" snapshot_spec: {}
- Get the list of schedules using the list REST API method for the SnapshotSchedule resource or the SnapshotScheduleService/List gRPC API call.
- Get the list of disks using the list REST API method for the Disk resource or the DiskService/List gRPC API call.
- Update the list of disks in a schedule using the updateDisks REST API method for the
SnapshotSchedule
resource or the SnapshotScheduleService/UpdateDisks gRPC API call.
Examples
Updating the name of a schedule
-
Get a list of schedules in the default folder:
yc compute snapshot-schedule list --format yaml
Result:
- id: fc852cvb1ipd5******** folder_id: e1ea8s8l71li******** created_at: "2022-09-28T13:25:02Z" ... expression: 10 19 ? * * snapshot_count: "7" snapshot_spec: {}
-
Update the name of the selected schedule:
yc compute snapshot-schedule update sched-1 \ --new-name "my-schedule"
Result:
done (3s) id: fc8e52mvchb2******** folder_id: e1ea8s8l71li******** ... expression: 36 14 */1 * * snapshot_count: "3" snapshot_spec: {}