Recovering a disk from a snapshot
Note
You cannot recover a boot disk of an existing VM from a snapshot or image. However, you can create a new VM to recover a boot disk from a snapshot. To recover a boot disk on an existing VM, use Yandex Cloud Backup.
To create a disk from a snapshot:
-
In the management console
, select the folder where you want to create a disk. -
Select Compute Cloud.
-
In the left-hand panel, select
-
Click Create disk.
-
Enter the disk 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.
-
If required, provide an arbitrary description for the disk.
-
Select the availability zone to place the disk in.
-
Set the disk parameters: disk type, block size, and disk size.
-
In the Contents field, select
Snapshot
and then select the snapshot you need from the list below. Use the filter to find the snapshot. -
If required, select a schedule for automatic snapshot creation, or set up a new schedule. For more information about setting up schedules, see the guide.
You can create snapshots of network drives, such as HDDs, SSDs, high-performance SSDs, and non-replicated SSDs. While taking a snapshot, high-performance and non-replicated SSDs are not available for writes. To take snapshots from local disks residing on dedicated hosts, use Yandex Cloud Backup. This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.
When creating a disk, you can select only one snapshot schedule. Once the disk is created, you can add a few more schedules by following the instructions.
-
Click Create disk.
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 disks and their snapshots:
yc compute disk create --help yc compute snapshot --help
-
Get a list of snapshots in the default folder:
yc compute snapshot list
Result:
+----------------------+----------------------+----------------------+----------+ | ID | NAME | PRODUCT IDS | STATUS | +----------------------+----------------------+----------------------+----------+ | fd84hanhvjql******** | disk-1-1668075122980 | f2ef3frbftr2******** | READY | | fd85mc22cosp******** | disk-2-1669114692462 | f2ef3frbftr2******** | READY | +----------------------+----------------------+----------------------+----------+
-
Select the ID (
ID
) or the name (NAME
) of the desired snapshot. -
Create a disk from the selected snapshot.
yc compute disk create <disk_name> \ --source-snapshot-name <snapshot_name> \ --description <text_description_of_disk>
You can use the
--source-snapshot-name
or--source-snapshot-id
parameter to specify the snapshot.For more information about the
yc compute disk create
command, see the CLI reference. -
Get a list of disks in the default folder:
yc compute disk list
Result:
+----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+ | ID | NAME | SIZE | ZONE | STATUS | INSTANCE IDS | PLACEMENT GROUP | DESCRIPTION | +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+ | a7lqgbt0bb9s******** | first-disk | 20401094656 | ru-central1-a | READY | a7lcvu28njbh******** | | | | a7lv5j5hm1p1******** | second-disk | 21474836480 | ru-central1-a | READY | | | | +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
Get the same list with more details in YAML format:
yc compute disk list --format yaml
Result:
- id: fhm4aq4hvq5g******** folder_id: b1gm3og7ei7a******** created_at: "2018-10-29T07:43:06Z" name: first-disk description: my first disk via yc type_id: network-hdd zone_id: ru-central1-a size: "10737418240" status: READY - id: fhmo6rdqg5fo******** folder_id: b1gm3og7ei7a******** created_at: "2018-10-29T07:33:04Z" name: second-disk description: my second disk via yc type_id: network-hdd zone_id: ru-central1-a size: "8589934592" product_ids: - f2en2dtd08b5******** status: READY source_image_id: fdvk34al8k5n******** instance_ids: - fhm5b617fjnj********
- Retrieve a list of snapshots using the SnapshotService/List gRPC API method or the list method of the REST API
Snapshot
resource. - Create a disk using the DiskService/Create gRPC API method or the create method of the REST API
Disk
resource. Specify the snapshot ID in your request.
Once created, the disk will get the CREATING
status. Wait until the disk status changes to READY
before using it.