官术网_书友最值得收藏!

How to snapshot a disk

Snapshots are used to back up persistent disks. They are different from backup disk images since they are created to be used periodically. If we create subsequent snapshots of persistent disk, only the first snapshot will back up the entire data of disk, while the other ones will only have reference to prior snapshots for the duplicate data and will contain updated data or newly added data with logs. This reduces total storage to be used and hence reduces the billing amount. To create a persistent disk snapshot, follow these steps:

  1. Use the gcloud compute disks snapshot command and provide a disk name as an argument:
gcloud compute disks snapshot sda  
  1. It returns a status flag result as READY or FAILED. To verify the snapshot creation, use the following:
gcloud compute snapshots list  
  1. To restore data from the created snapshot, create a persistent disk larger than the size of the snapshot. Do this from the snapshot itself and make sure you are not doing it from the root directory:
gcloud compute disks create sdb  --source-snapshot=test-instance-snapshot --size=600GB  
  1. Attach this persistent disk to an instance:
gcloud compute instances attach-disk test-instance01 --disk=sdb  
  1. The preceding command is useful when snapshot and restoration disks are of the same type. For different types of disks, use a type argument and provide the disk type.
  2. Finally, to delete the snapshot, use the following command:
gcloud compute snapshots delete test-instance-snapshot  
主站蜘蛛池模板: 同心县| 页游| 古交市| 行唐县| 阿拉善右旗| 靖州| 景宁| 海阳市| 忻城县| 中西区| 怀安县| 满洲里市| 梁山县| 宁明县| 宁明县| 郴州市| 井研县| 昭觉县| 扶绥县| 西平县| 枣阳市| 金乡县| 长泰县| 集贤县| 南投市| 新竹市| 民乐县| 灵宝市| 呼伦贝尔市| 昆山市| 武陟县| 阜城县| 乌兰县| 启东市| 屏山县| 黑龙江省| 长岭县| 施甸县| 长沙县| 托里县| 无棣县|