創建快照
更新時間 2025-04-29 18:15:39
最近更新時間: 2025-04-29 18:15:39
分享文章
本節主要介紹使用命令行創建快照。
OpenStack命令行:
openstack volume snapshot create --volume { volume_id | volume_name } [ snapshot_name ] [ --description snapshot_description ]
Cinder命令行:
cinder snapshot-create { volume_id | volume_name } [ --name snapshot_name ] [ --description snapshot_description ]
此命令用來創建快照。
參數
| 參數 | 描述 |
|---|---|
| volume_id | 要創建快照的卷的ID。 |
| volume_name | 要創建快照的卷的名稱。 |
| --name snapshot_name | 指定快照的名稱。 注意 這里的快照名稱與HBlock中的快照名稱不同,HBlock中的快照名稱,對應Cinder中的快照ID前面增加snapshot-。 |
| --description snapshot_description | 指定快照的描述信息。 說明 此描述信息僅為快照在Cinder上的描述信息,不是快照在HBlock端的描述信息。 |
示例
示例1
創建快照snapshot-w5。
[root@controller cinder(keystone_admin)]# openstack volume snapshot create --volume lun_001 snapshot-w5 --description "This is a test snapshot"
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| created_at | 2025-04-25T02:01:35.780265 |
| description | This is a test snapshot |
| id | 8f65856b-c5b6-4f45-b171-472f284f2fd7 |
| name | snapshot-w5 |
| properties | |
| size | 1 |
| status | creating |
| updated_at | None |
| volume_id | 6b1649ea-48ec-4392-b4e8-f919cf484f43 |
+-------------+--------------------------------------+示例2
創建快照snapshot-w3。
[root@controller cinder(keystone_admin)]# cinder snapshot-create lun_001--name snapshot-w3 --description "This is a test snapshot"
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| consumes_quota | True |
| created_at | 2025-04-25T02:02:04.712369 |
| description | This is a test snapshot |
| group_snapshot_id | None |
| id | ff273f8d-a35f-44da-8be4-1f92b7749ed2 |
| metadata | {} |
| name | snapshot-w3 |
| size | 1 |
| status | creating |
| updated_at | None |
| user_id | d60fa5458fda4f96bbf581bf6c2dd63e |
| volume_id | 6b1649ea-48ec-4392-b4e8-f919cf484f43 |
+-------------------+--------------------------------------+