Stay organized with collections Save and categorize content based on your preferences.
Windows
In Compute Engine, you can use snapshots to back up your disk data. Because snapshots are incremental, you can create them with higher performance and lower total storage charges compared to creating complete disk images.
Application consistent snapshots capture the state of application data at the time of backup with all application transactions completed and all pending writes flushed to the disk. On Windows VMs, you use the Volume Shadow Copy Service (VSS) to create application consistent snapshots without first stopping the instance or detaching the disk from your VM.
Caution: If you have enabled BitLocker on a boot disk that is based on a Shielded VM image, you can restore a snapshot of that boot disk to another disk, but you can't decrypt the restored instance. This is because the vTPM containing the BitLocker keys is only available to the virtual machine (VM) instance that originated the snapshot. For more information, see Using BitLocker with Shielded VM images. Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
Disk snapshots on Windows have the following limitations:
v20160810
and newer. For instances with older images, create a snapshot without using VSS.You can create Volume Shadow Copy Service (VSS) snapshots without having to stop the instance or detach the disk from your VM. VSS snapshots are intended for backup and recovery purposes on systems with VSS-aware apps.
VSS snapshots are the same price as normal Persistent Disk or Hyperdisk snapshots, and charge only for the total size of the snapshot.
Create the snapshot Caution: If you try to create a snapshot from a disk and the snapshot creation process fails, you won't be able to delete the original disk volume until you clean up the failed snapshot and capture a clean snapshot. This failsafe helps to prevent the accidental deletion of source data in the event of an unsuccessful backup. ConsoleGo to the Create a Snapshot page in the Google Cloud console.
Go to the Create a Snapshot pageSelect a Snapshot type. The default is a STANDARD
snapshot, which is the best option for long-term back up and disaster recovery.
Choose Archive snapshot for more cost-efficient data retention.
In the Location section, choose your snapshot storage location.
The predefined or customized default location defined in your snapshot settings is automatically selected. Optionally, you can override the snapshot settings and store your snapshots in a custom storage location by doing the following:
Choose the type of storage location that you want for your snapshot.
To create a VSS snapshot, use the gcloud compute snapshots create
command and include the --guest-flush
flag.
You can create your snapshot in the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, use the gcloud compute snapshots create
command.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-zone=SOURCE_ZONE \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE \ --guest-flush
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, include the --storage-location
flag to indicate where to store your snapshot.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-zone=SOURCE_ZONE \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE \ --storage-location=STORAGE_LOCATION \ --guest-flush
(Preview) To create a regionally scoped snapshot in an allowed region, include the --region
flag to indicate where to create your snapshot.
gcloud beta compute snapshots create SNAPSHOT_NAME \ --region=SNAPSHOT_SCOPE_REGION --source-disk=SOURCE_DISK_NAME \ --source-disk-zone=SOURCE_ZONE \ --snapshot-type=SNAPSHOT_TYPE
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the --storage-location
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the --storage-location
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
gcloud compute snapshots create
command instead of the gcloud compute disks snapshot
command because it supports more features, such as creating snapshots in a project different from the source disk project.
To create a VSS snapshot of a regional Persistent Disk, in the previous examples replace --source-disk-zone=
with --source-disk-region=
, and specify the region where your regional Persistent Disk is located.
The Google Cloud CLI waits until the operation returns a status of READY
, FAILED
, or reaches the maximum timeout and returns the last known details of the snapshot.
When creating a snapshot, to indicate that you want to create a VSS snapshot, include the guestFlush
property in the request body for your POST
request to the compute.snapshots.insert
method.
You can create your snapshot in the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, make a POST
request to the snapshots.insert
method:
POST https://compute.googleapis.com/compute/beta/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE", "guestFlush": true, }
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, make a POST
request to the snapshots.insert
method and include the storageLocations
property in your request:
POST https://compute.googleapis.com/compute/beta/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE", "storageLocations": [ "STORAGE_LOCATION" ], "guestFlush": true, }
(Preview) To create a regionally scoped snapshot in an allowed region, make a POST
request to the snapshots.insert
method and define the creation region:
POST https://compute.googleapis.com/compute/beta/projects/DESTINATION_PROJECT_ID/regions/SNAPSHOT_SCOPE_REGION/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE" }
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the storageLocations
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the storageLocations
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
snapshots.insert
method instead of the disks.createSnapshot
method because it supports more features, such as creating snapshots in a project different from the source disk project.
To create a VSS snapshot of a regional Persistent Disk, in the POST
requests shown previously, replace the following line:
"sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME",Use this line instead when creating a snapshot of a regional Persistent Disk:
"sourceDisk": "projects/SOURCE_PROJECT_ID/regions/SOURCE_REGION/disks/SOURCE_DISK_NAME",Create a writable disk from a VSS snapshot
When you create a VSS snapshot, Windows Server marks the volume in the snapshot as read-only. When you create a new disk from the VSS snapshot, that disk is also set to read-only mode.
This might cause issues. For example, if you create a VM instance with a new boot disk from a VSS snapshot of an existing boot disk, the read-only flag on the new boot disk prevents the VM from booting correctly.
To work around this issue, remove the read-only flag from any new disk that you create from a VSS snapshot using the following steps:
Make sure the disk is attached to a VM:
Sign in to the Windows VM that the disk is attached to.
Open a PowerShell command prompt and run the diskpart
tool.
PS C:\> diskpart
Identify the disk that you want to mount.
DISKPART> list disk
Use the select disk
command to select the disk.
DISKPART> select disk DISK_NUMBER
Replace DISK_NUMBER
with the number of the disk that you want to mount.
Mount the disk.
DISKPART> online disk
List all the volumes in the disk.
DISKPART> list volume
Select the new volume.
DISKPART> select volume VOLUME_NUMBER
Replace VOLUME_NUMBER
with the number of the volume to configure as read and write.
Clear the read-only flag.
DISKPART> attr volume clear readonly hidden nodefaultdriveletter shadowcopy
Exit the diskpart
tool.
DISKPART> exit
If the disk is a boot disk for another VM, sync the boot disk files with the new disk signature.
PS C:\> bcdboot DRIVE_LETTERWindows /s DRIVE_LETTER
Replace DRIVE_LETTER
with the drive letter for the volume that you want to sync. For example, F
for F:\
.
In some situations, you might want to create snapshots of disks that are attached to Windows VMs without using VSS.
To create a disk snapshot on a Windows VM without using VSS, do the following:
Prepare your system for a clean snapshotBefore you create a disk snapshot, make sure that you are taking a snapshot that is consistent with the state that you want for the disk. If you take a snapshot of your disk in an "unclean" state, it may force a disk check and possibly lead to data loss. Consider syncing and unmounting your file system.
Sync the file systemIf unmounting your disk is not an option, such as in scenarios where an application might be writing data to the disk, you can sync your file system to flush the disk buffers. To sync your file system:
In the command line window, run:
PS C:\> sync DRIVE_LETTER
Replace DRIVE_LETTER
with the drive letter for the volume that you want to sync. For example, F
for F:\
.
Sign in to your Windows VM.
Open a PowerShell command prompt and run the diskpart
tool.
PS C:\> diskpart
Identify the disk that you want to unmount and snapshot.
DISKPART> list disk
Next, select the disk using the disk number that you just found.
DISKPART> select disk DISK_NUMBER
Replace DISK_NUMBER
with the number of the disk that you want to remount.
Unmount the disk.
DISKPART> offline disk
Sign in to your Windows VM.
Open a PowerShell command prompt and run the diskpart
tool.
PS C:\> diskpart
Identify the disk that you want to mount.
DISKPART> list disk
Use the select disk
command to select the disk.
DISKPART> select disk DISK_NUMBER
Replace DISK_NUMBER
with the number of the disk that you want to mount.
Mount the disk.
DISKPART> online disk
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Compute Engine uses snapshots to back up disk data incrementally, offering higher performance and lower storage costs compared to complete disk images."],["Windows VMs utilize the Volume Shadow Copy Service (VSS) to create application-consistent snapshots, capturing application data at the time of backup without requiring instance stoppage or disk detachment."],["VSS snapshots on Windows are only compatible with instances using image version `v20160810` and newer, and the attached disk must use an NTFS, exFAT, or ReFS file system."],["Creating a VSS snapshot will mark the volume as read-only, and disks created from such snapshots are also read-only, which can be resolved by using the diskpart tool to remove the read-only flag."],["Snapshots can also be created on Windows VMs without using VSS, which involves preparing the system by syncing or unmounting the file system before taking the snapshot and marking the disk as available for read/write afterwards."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4