You can use a Persistent Disk as a boot disk for a virtual machine (VM) instance, or as a data disk that you attach to a VM. This document explains how to modify existing Persistent Disk volumes to do the following:
At times, you need to change the type of a particular Persistent Disk volume to meet your performance or pricing requirements. For example, you might want to change a workload's data disk from a standard Persistent Disk to a balanced Persistent Disk.
You can't directly change the type of an existing Persistent Disk volume. You must create a snapshot of the existing disk and then use that snapshot to create a disk of the new type.
For example, to change a standard Persistent Disk to an SSD Persistent Disk, use the following process:
You can automatically delete read/write Persistent Disk volumes when the associated VM instance is deleted. This behavior is controlled by the autoDelete
property on the VM instance for a given attached disk and can be updated at any time. Similarly, you can prevent a Persistent Disk volume from being deleted by marking the autoDelete
value as false.
In the Google Cloud console, go to the VM instances page.
Select the instance that has the disks associated with it.
Click the instance name. The VM instance details page appears.
Click Edit.
In the Storage section, under the heading Additional disks, click the pencil icon mode_edit to change the disk's Deletion Rule.
Click Save to update your instance.
Set the auto-delete state of a Persistent Disk with the gcloud compute instances set-disk-auto-delete
command. To keep the disk, use the --no-auto-delete
flag. To delete the disk, use the --auto-delete
flag.
gcloud compute instances set-disk-auto-delete VM_NAME \ AUTO_DELETE_SETTING \ --disk DISK_NAME
Replace the following:
VM_NAME
: the name of the instanceAUTO_DELETE_SETTING
: whether or not to automatically delete the disk. Specify --no-auto-delete
to keep the disk after deleting the VM, and --auto-delete
to delete the disk at the same time as the VMDISK_NAME
: the name of the diskBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.jsBefore trying this sample, follow the Node.js setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Node.js API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTTo set the auto-delete state using the API, make a POST
request to the instances.setDiskAutoDelete method.
Use the autoDelete
parameter to indicate whether to delete the disk.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/setDiskAutoDelete?deviceName=DISK_NAME,autoDelete=AUTO_DELETE_OPTION
Replace the following:
PROJECT_ID
: your project IDZONE
: the zone where your instance and disk are locatedVM_NAME
: the name of your instanceDISK_NAME
: the name of the disk attached to the instance.AUTO_DELETE_OPTION
: whether or not to automatically delete the disk when the VM is deleted. To delete the disk, set to true
. Set to false
to keep the disk after deleting the VM.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