A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/disks/regional-persistent-disk below:

Create and manage regional disks | Compute Engine Documentation

Hyperdisk Balanced High Availability and regional Persistent Disk

are storage options that let you implement high availability (HA) services in Compute Engine. Regional Persistent Disk and Hyperdisk Balanced High Availability synchronously replicate data between two zones in the same region and ensure HA for disk data for up to one zonal failure. The regional disk can be a boot disk or a non-boot disk.

You can also allow different instances to concurrently access a Hyperdisk Balanced High Availability disk by setting the disk access mode. Regional disks can only be attached to instances in the same zones as the disk's replicas. For more information, see Share a disk between instances.

This document explains how to do the following tasks for regional disks:

Before you begin Required roles and permissions

To get the permissions that you need to create a regional disk, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to create a regional disk. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to create a regional disk:

You might also be able to get these permissions with custom roles or other predefined roles.

Limitations About using a regional disk as a boot disk for an instance

You can attach a regional Persistent Disk or Hyperdisk Balanced High Availability disk as a boot disk for stateful workloads that are provisioned ahead of time, before you provision a production workload. Regional boot disks are not intended for hot standbys, because the regional boot disks cannot be attached simultaneously to two compute instances.

You can only create regional Persistent Disk or Hyperdisk Balanced High Availability volumes from snapshots; it isn't possible to create a regional disk from an OS image.

To use a regional disk as the boot disk for an instance, use either of the following methods:

  1. Create a new instance with a regional boot disk.
  2. Create a regional boot disk, and then attach it to an instance:
    1. Create a regional disk from a snapshot of a boot disk.
    2. Attach a regional boot disk to an instance.

If you need to failover a regional boot disk to a running standby instance in the replica zone, then use the steps described in Attach a regional boot disk to an instance.

Create a regional disk

Create a regional Persistent Disk or Hyperdisk Balanced High Availability volume. The disk must be in the same region as the compute instance that you plan to attach it to.

If you create a Hyperdisk Balanced High Availability volume, you can also allow different instances to concurrently access the disk by setting the disk access mode. For more information, see Share a disk between instances.

For regional Persistent Disk, if you create a disk in the Google Cloud console, the default

disk type

is

pd-balanced

. If you create a disk using the gcloud CLI or REST, the default disk type is

pd-standard

.

Console
  1. In the Google Cloud console, go to the Disks page.

    Go to Disks

  2. Select the required project.

  3. Click Create disk.

  4. Specify a Name for your disk.

  5. For the Location, choose Regional.

  6. Select the Region and Zone. You must select the same region when you create your instance.

  7. Select the Replica zone in the same region. Make a note of the zones that you select because you must attach the disk to your instance in one of those zones.

  8. Select the Disk source type.

  9. Under Disk settings, choose a Disk type and Size. You can also change the default Provisioned IOPS, and Provisioned Throughput settings.

  10. Optional: For Hyperdisk Balanced High Availability volumes, you can enable attaching the disk to multiple instances by creating the disk in multi-writer mode. In Access mode, select Multiple VMs read write.

  11. Click Create to finish creating your disk.

gcloud

Create a regional disk by using the compute disks create command.

If you need a regional SSD Persistent Disk for additional throughput or IOPS, include the --type flag and specify pd-ssd.

gcloud compute disks create DISK_NAME \
   --size=DISK_SIZE \
   --type=DISK_TYPE \
   --region=REGION \
   --replica-zones=ZONE1,ZONE2
   --access-mode=DISK_ACCESS_MODE

Replace the following:

Terraform

To create a regional Persistent Disk or Hyperdisk Balanced High Availability volume, you can use the google_compute_region_disk resource.

REST

To create a regional Persistent Disk or Hyperdisk Balanced High Availability volume, construct a POST request to the compute.regionDisks.insert method.

To create a blank disk, don't specify a snapshot source.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/disks
{
  "name": "DISK_NAME",
  "region": "projects/PROJECT_ID/regions/REGION",
  "replicaZones": [
    "projects/PROJECT_ID/zones/ZONE1",
    "projects/PROJECT_ID/zones/ZONE2"
  ],
  "sizeGb": "DISK_SIZE",
  "type": "projects/PROJECT_ID/regions/REGION/diskTypes/DISK_TYPE",
  "accessMode": "DISK_ACCESS_MODE"
}

Replace the following:

Attach a regional disk to your instance

For disks that are not boot disks, after you create a regional Persistent Disk or Hyperdisk Balanced High Availability volume, you can attach it to an instance. The instance must be in the same region as the disk.

To attach a regional boot disk to an instance, see Attach a regional boot disk to an instance.

To attach a Hyperdisk Balanced High Availability disk to multiple instances, repeat the procedure in this section for each instance. You can attach Hyperdisk Balanced High Availability disks only in read-write mode.

Console
  1. To attach a disk to an instance, go to the VM instances page.

    Go to VM instances

  2. In the Name column, click the name of the instance.

  3. Click Edit edit.

  4. Click +Attach existing disk.

  5. Choose the previously created regional disk to add to your instance.

  6. If you see a warning that indicates the selected disk is already attached to another instance, select the Force-attach disk box to force-attach the disk to the instance that you are editing.

    Review the use cases for force-attaching regional disks at Regional disk failover.

  7. Optional: If attaching a Hyperdisk Balanced High Availability disk to multiple instances, for Disk attachment mode, select Read/write.

  8. Click Save.

  9. On the Edit VM page, click Save.

gcloud

To attach a regional disk to a running or stopped instance, use the compute instances attach-disk command with the --disk-scope flag set to regional.

If attaching a Hyperdisk Balanced High Availability disk in multi-writer mode to multiple instances, the only supported attachment mode is rw, which is is the default access mode. You don't need to include the --mode flag.

gcloud compute instances attach-disk INSTANCE_NAME \
    --disk=DISK_NAME \
    --disk-scope=regional \
    --device-name=DEVICE_NAME

Replace the following:

Terraform

To attach a regional Persistent Disk or Hyperdisk Balanced High Availability volume to an instance, you can use the google_compute_attached_disk resource.

REST

To attach a regional disk to a running or stopped instance, construct a POST request to the compute.instances.attachDisk method and include the URL to the regional disk that you created.

If attaching a Hyperdisk Balanced High Availability disk in multi-writer mode to multiple instances, the only supported attachment mode is READ-WRITE, which is is the default access mode. You don't need to include the mode property.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/attachDisk
{
  "source": "/projects/PROJECT_ID/regions/REGION/disks/DISK_NAME",
  "deviceName": DEVICE_NAME
}

Replace the following:

For non-boot disks, after you create and attach a blank regional disk to a instance, you must format and mount the disk, so that the operating system can use the available storage space.

Change a zonal disk to a regional disk

To convert an existing zonal Persistent Disk to a Regional Persistent Disk, create a new disk by cloning an existing zonal disk. For more information, see

Creating a regional disk clone from a zonal disk

.

To convert a Hyperdisk to a regional disk, create a new Hyperdisk Balanced High Availability disk from a snapshot of the existing disk, as described in Change a zonal disk to a Hyperdisk Balanced High Availability disk.

Create a new instance with a regional boot disk

When setting up a highly available compute instance, you can create the primary instance with a regional boot disk. If a zonal outage occurs, this lets you restart the instance in the secondary zone instead of creating a new instance.

In a high availability setup, if the boot device is a regional disk, Google recommends that you don't pre-create and start the standby instance. Instead, at the failover stage, attach the existing regional disk when you create the standby instance by using the forceAttach option.

Important: You can't use a disk that's in multi-writer mode as a boot disk.

If you want to change an existing zonal disk to a regional disk, see Change a zonal disk to a regional disk instead. Otherwise, to create an instance with a boot disk that is a regional disk, use one of the following methods:

Console
  1. In the Google Cloud console, go to the Create an instance page.

    Go to Create an instance

    If prompted, select your project and click Continue.

    The Create an instance page appears and displays the Machine configuration pane.

  2. In the Machine configuration pane, do the following:

    1. In the Name field, specify a name for your instance. For more information, see Resource naming convention.
    2. Optional: In the Zone field, select a zone for this instance.

      The default selection is Any. If you don't change this default selection, then Google automatically chooses a zone for you based on machine type and availability.

    3. Select a machine family for your instance from one of the following options:

      • General purpose
      • Compute optimized
      • Memory optimized
      • Storage optimized
      • GPUs

      The Google Cloud console then displays the machine series that are available for your selected machine family.

    4. In the Series column, select the machine series for your instance.

      If you selected GPUs as the machine family in the previous step, then select the GPU type that you want. The machine series is then automatically selected for the selected GPU type.

    5. In the Machine type section, select the machine type for your instance.

  3. In the navigation menu, click OS and storage. In the Operating system and storage pane that appears, complete the following steps.

    To learn more about the parameters that you can configure while adding new disks, see About Persistent Disk and About Google Cloud Hyperdisk.

    1. To start configuring your boot disk, click Change. The Boot disk pane appears and displays the Public images tab.
    2. Configure the data source for the boot disk in one of the following ways:

      Note: Unless you explicitly choose a different boot disk, if the name of the new instance matches the name of an existing disk, then the existing disk automatically attaches to the new instance as the boot disk.
      • To choose a standard snapshot as the data source for your boot disk, click Snapshots and then, in the Snapshots tab that appears, specify the following:

        1. In the Snapshot list, select the snapshot.
        2. In the Boot disk type list, select the type of the boot disk.
        3. In the Size (GB) field, specify the size of the boot disk.
      • To choose an archive snapshot as the data source for your boot disk, click Archive snapshots and then, in the Archive snapshots tab that appears, specify the following:

        1. In the Archive snapshot list, select the archive snapshot.
        2. In the Boot disk type list, select the type of the boot disk.
        3. In the Size (GB) field, specify the size of the boot disk.
      • To choose an existing disk as your boot disk, click Existing disks. Then, in the Existing disks tab that appears, select an existing regional Persistent Disk or Hyperdisk Balanced High Availability volume in the Disk list.

    3. Optional: For advanced configuration options, expand the expand_more Show advanced configurations section.

    4. To confirm your boot disk options and return to the Operating system and storage pane, click Select.

    5. Optional: To learn how to attach non-boot disks to your instance, see Create an instance with additional non-boot disks.

  4. If you did not choose an existing boot disk, configure it to be a regional disk by doing the following:

    1. In the navigation menu, click Data protection. In the Data protection pane that appears, do the following:

      Caution: The data backup and replication settings that you specify while creating an instance using the Google Cloud console are applied only when your selected instance and disk configurations support those options. You must verify that your configuration for the instance and each disk meets the requirements for each data protection option that you specify. For more information, see the requirements for regional disks and Data protection options.
      1. To configure all new disks for the instance to use synchronous disk replication (regional Persistent Disk or Hyperdisk Balanced High Availability), select the Regional disks checkbox.

      2. (No action required by default.) Clear the Exclude boot disks checkbox.

  5. Optional: Specify other configuration options. For more information, see Configuration options during instance creation.

  6. To create and start the instance, click Create.

gcloud

Use the gcloud compute instances create command to create an instance, and the --create-disk flag to specify the regional disk.

gcloud compute instances create PRIMARY_INSTANCE_NAME  \
 --zone=ZONE  \
 --create-disk=^:^name=REGIONAL_DISK_NAME:boot=true:type=DISK_TYPE:source-snapshot=SNAPSHOT_NAME:replica-zones=ZONE,REMOTE_ZONE

When specifying the disk parameters, the characters ^:^ specify that the separation character between parameters is a colon (:). This lets you use a comma (,) when specifying the replica-zones parameter.

Replace the following:

REST

Create a POST request to the instances.insert method and specify the properties boot: 'true' and replicaZones. For example:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances
{
 "name": "INSTANCE_NAME",
 "disks": [{
    "boot": true,
    "initializeParams": {
       "sourceSnapshot": "global/snapshots/BOOT_SNAPSHOT_NAME",
       "replicaZones": [
           "projects/PROJECT_ID/zones/ZONE",
           "projects/PROJECT_ID/zones/REMOTE_ZONE"
       ],
       "diskType": "projects/PROJECT_ID/zones/ZONE/diskTypes/DISK_TYPE"
    }
  }],
 "networkInterfaces": [
    {
      "network": "global/networks/default"
    }
  ]
}

Replace the following:

Create a new instance with additional regional disks

When creating an instance, you can optionally include regional Persistent Disk or Hyperdisk Balanced High Availability volumes as additional disks.

To create and attach a regional Persistent Disk or Hyperdisk Balanced High Availability volume to an instance during instance creation, see either of the following:

Attach a regional boot disk to an instance

Use the following steps to:

These steps assume that the regional disk and instance already exist.

gcloud
  1. Stop the instance.
    gcloud compute instances stop INSTANCE_NAME  --zone=ZONE
    
  2. Detach the current boot disk from the instance.
    gcloud compute instances detach-disk INSTANCE_NAME \
     --zone=ZONE --disk=CURRENT_BOOT_DEVICE_NAME
    
  3. Attach the regional boot disk to the instance.
    gcloud compute instances attach-disk INSTANCE_NAME  \
     --zone=ZONE  \
     --disk=REGIONAL_DISK_NAME  \
     --disk-scope=regional --force-attach \
     --boot
    
  4. Restart the instance.

    gcloud compute instances start INSTANCE_NAME
    
    Note: If the instance you want to start uses customer-supplied encryption keys, you must provide those keys when trying to start the instance. For more information, see Start an instance that has encrypted disks.

Replace the variables in the previous commands with the following:

Optional: If you can't successfully detach the regional boot disk from the primary instance due to an outage or failure, include the flag --force-attach.

REST
  1. Stop the instance.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop
    
  2. Detach the current boot disk from the instance.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/detachDisk?deviceName=CURRENT_BOOT_DEVICE_NAME
    
  3. Attach the regional boot disk to the instance.

    Construct a POST request to the compute.instances.attachDisk method, and include the URL to the regional boot disk:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/attachDisk
    {
    "source": "compute/v1/projects/PROJECT_ID/regions/REGION/disks/REGIONAL_DISK_NAME",
    "boot": true
    }
  4. Restart the instance.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/start
    
    Note: If the instance you want to start uses customer-supplied encryption keys, you must provide those keys when trying to start the instance. For more information, see Start an instance that has encrypted disks.

Replace the variables in the previous commands with the following:

Optional: If you can't successfully detach the regional boot disk from the instance that it was originally attached to because of an outage or failure, include "forceAttach": true in the request body.

List and describe your regional disks

You can view a list of all your configured regional disks, and information about their properties, including the following:

To view detailed information about your regional disks, use the following:

Resize a regional disk

If instances with regional disks require additional storage space, you can resize the disks. You can resize disks at any time, regardless of whether the disk is attached to a running instance. If you need to separate your data into unique volumes, create multiple secondary disks for the instance. For Hyperdisk Balanced High Availability you can also increase the IOPS and throughput limits for the disk.

The command for resizing a regional disk is very similar to that for resizing a zonal disk. However, you must specify a region instead of a zone for the disk location.

You can only increase, and not decrease, the size of a disk. To decrease the disk size, you must create a new disk with a smaller size. Until you delete the original, larger disk, you are charged for both disks.

For instructions on how to modify a regional disk, see the following:

What's next

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