새 Hyperdisk 볼륨 만들기


다음 태스크를 완료하여 Compute Engine 인스턴스에 Hyperdisk Balanced, Hyperdisk Extreme 또는 Hyperdisk Throughput 볼륨을 사용할 수 있습니다.

  • 비어 있는 비부팅 영역별 Hyperdisk 볼륨을 만들고 인스턴스 생성 중 또는 후에 인스턴스에 연결합니다.
  • 볼륨을 포맷하고 마운트하여 데이터 또는 파일 시스템에 대한 액세스 기능을 제공합니다.

Hyperdisk Balanced 볼륨의 경우 데이터 디스크뿐만 아니라 부팅 디스크도 만들 수 있습니다.

하이퍼디스크에 대한 일반적인 내용은 하이퍼디스크 정보를 참조하세요.

인스턴스에 Hyperdisk Balanced 고가용성 디스크를 추가하려면 다음 절차를 따르세요.

시작하기 전에

  • 컴퓨팅 인스턴스에 Hyperdisk 볼륨을 추가하기 전에 Hyperdisk 제한사항을 검토하세요.
  • 아직 인증을 설정하지 않았다면 설정합니다. 인증은 Google Cloud 서비스 및 API에 액세스하기 위해 ID를 확인하는 프로세스입니다. 로컬 개발 환경에서 코드 또는 샘플을 실행하려면 다음 옵션 중 하나를 선택하여 Compute Engine에 인증하면 됩니다.

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.
    3. Go

      로컬 개발 환경에서 이 페이지의 Go 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.

      1. Install the Google Cloud CLI.
      2. To initialize the gcloud CLI, run the following command:

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.

      Java

      로컬 개발 환경에서 이 페이지의 Java 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.

      1. Install the Google Cloud CLI.
      2. To initialize the gcloud CLI, run the following command:

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.

      Node.js

      로컬 개발 환경에서 이 페이지의 Node.js 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.

      1. Install the Google Cloud CLI.
      2. To initialize the gcloud CLI, run the following command:

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.

      REST

      로컬 개발 환경에서 이 페이지의 REST API 샘플을 사용하려면 gcloud CLI에 제공한 사용자 인증 정보를 사용합니다.

        Install the Google Cloud CLI, then initialize it by running the following command:

        gcloud init

      자세한 내용은 Google Cloud 인증 문서의 REST 사용을 위한 인증을 참고하세요.

필수 역할 및 권한

인싀턴스에 Hyperdisk 볼륨을 추가하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요.

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

이러한 사전 정의된 역할에는 인스턴스에 Hyperdisk 볼륨을 추가하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.

필수 권한

인스턴스에 Hyperdisk 볼륨을 추가하려면 다음 권한이 필요합니다.

  • 하이퍼디스크 볼륨을 만들고 연결하려면:
    • 프로젝트에 대한 compute.disks.create 권한
    • 인스턴스에 대한 compute.instances.attachDisk 권한
    • 인스턴스에 연결할 볼륨에 대한 compute.disks.use 권한
  • 연결된 볼륨을 포맷하고 마운트하려면: 인스턴스에 대한 compute.instances.setMetadata 권한

커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.

하이퍼디스크 볼륨에 지원되는 값

Hyperdisk 볼륨을 만들거나 수정할 때 사용하는 값은 디스크당 Hyperdisk 한도에 설명된 최댓값과 최솟값 범위 내에 있어야 합니다.

VM에 연결된 Hyperdisk 볼륨의 크기를 수정하는 경우 새 값이 VM당 Hyperdisk 한도를 초과할 수 없습니다.

Hyperdisk 볼륨의 프로비저닝된 IOPS 및 처리량은 Hyperdisk의 IOPS 및 처리량 프로비저닝 정보에 설명된 규칙을 따라야 합니다.

인스턴스에 Hyperdisk 볼륨 추가

Google Cloud 콘솔, Google Cloud CLI 또는 REST를 사용하여 하이퍼디스크 볼륨을 만들고 연결할 수 있습니다.

Hyperdisk 볼륨을 만들 때 지정하는 크기, 처리량, IOPS는 지원되는 값 범위 내에 있어야 합니다.

Hyperdisk Balanced 볼륨을 만들 때 멀티 작성자 모드로 디스크를 만들어 선택적으로 여러 인스턴스가 디스크에 동시에 액세스하도록 허용할 수 있습니다.

콘솔

  1. VM 인스턴스 페이지로 이동합니다.

    VM 인스턴스로 이동

  2. 디스크를 추가하려는 인스턴스의 이름을 클릭합니다.

  3. VM 인스턴스 세부정보 페이지에서 수정을 클릭합니다.

  4. 추가 디스크 제목에서 새 디스크 추가를 클릭합니다.

  5. 디스크 이름을 지정하고 선택적으로 설명을 추가합니다. 디스크 소스 유형으로 빈 디스크를 선택합니다.

  6. 디스크 설정의 다음 목록에서 디스크 유형을 선택합니다. 지정하는 값이 지원되는 값 범위에 있어야 합니다.

    1. 하이퍼디스크 균형. 또한 기본 디스크 크기, 프로비저닝된 IOPS, 프로비저닝된 처리량 설정을 변경할 수 있습니다.
    2. 하이퍼디스크 익스트림. 기본 디스크 크기프로비저닝된 IOPS 설정을 변경할 수도 있습니다.
    3. Hyperdisk ML. 기본 디스크 크기프로비저닝된 처리량 설정을 변경할 수도 있습니다.
    4. 하이퍼디스크 처리량. 기본 디스크 크기프로비저닝된 처리량 설정을 변경할 수도 있습니다.
  7. 선택사항: Hyperdisk Balanced 볼륨의 경우 멀티 작성자 모드로 디스크를 만들어 디스크를 여러 인스턴스에 연결할 수 있습니다. 액세스 모드에서 여러 VM 읽기 쓰기를 선택합니다.

  8. 저장을 클릭합니다.

  9. 변경사항을 인스턴스에 적용하려면 저장을 클릭합니다.

gcloud

  1. gcloud compute disks create 명령어를 사용하여 하이퍼디스크 볼륨을 만듭니다.

    gcloud compute disks create DISK_NAME \
       --zone=ZONE \
       --size=DISK_SIZE \
       --type=DISK_TYPE \
       --provisioned-iops=IOPS_LIMIT
       --provisioned-throughput=THROUGHPUT_LIMIT
       --access-mode=DISK_ACCESS_MODE
    

    다음을 바꿉니다.

    • DISK_NAME: 새 디스크의 이름입니다.
    • ZONE: 새 디스크를 만들려는 영역의 이름입니다.
    • DISK_SIZE: 선택사항: 새 디스크의 크기입니다. 값은 정수이며 뒤에 크기 단위(기비바이트는 GB, 테비바이트는 TB)가 와야 합니다. 크기 단위를 지정하지 않으면 100GB가 기본값으로 사용됩니다. 디스크 크기에 허용되는 값은 다음과 같습니다.
      • 하이퍼디스크 균형: 4GiB부터 64TiB까지(1GiB 단위)
      • 하이퍼디스크 익스트림: 64GiB부터 64TiB까지(1GiB 단위)
      • Hyperdisk ML: 4GiB부터 64TiB까지(1GiB 단위)
      • 하이퍼디스크 처리량: 2TiB부터 32TiB까지(1GiB 단위)
    • DISK_TYPE: 디스크 유형입니다. hyperdisk-balanced, hyperdisk-extreme, hyperdisk-ml, hyperdisk-throughput 중 한 가지 값을 사용합니다.
    • IOPS_LIMIT: 선택사항: 하이퍼디스크 균형 또는 하이퍼디스크 익스트림 디스크의 경우 디스크가 처리할 수 있는 초당 I/O 작업(IOPS) 수입니다.
    • THROUGHPUT_LIMIT: 선택사항: Hyperdisk Balanced, Hyperdisk ML 또는 Hyperdisk Throughput 볼륨의 경우 디스크가 제공할 수 있는 최대 처리량(초당 MiB로 측정됨)을 나타내는 정수입니다.
    • DISK_ACCESS_MODE: 선택사항: 컴퓨팅 인스턴스가 디스크의 데이터에 액세스하는 방법입니다. 지원되는 값은 다음과 같습니다.

      • READ_WRITE_SINGLE: 한 인스턴스에서 읽기/쓰기 액세스를 위한 값입니다. 전역 window는 기본 설정이며,
      • READ_WRITE_MANY: 여러 인스턴스에서 동시에 읽기/쓰기 액세스가 가능한 경우(Hyperdisk Balanced 및 Hyperdisk Balanced 고가용성만 해당).
      • READ_ONLY_MANY: 여러 인스턴스에서 동시에 읽기 전용 액세스가 가능한 경우(Hyperdisk ML만 해당)

      Hyperdisk Balanced 고가용성 디스크에 대한 액세스 모드를 설정하려면 리전 디스크 만들기를 참조하세요.

  2. 선택사항: gcloud compute disks describe DISK_NAME 명령어를 사용하여 디스크의 설명을 확인합니다.

  3. 디스크를 만든 후 인스턴스에 디스크를 연결할 수 있습니다.

REST

  1. disks.insert 메서드를 사용하여 영역별 하이퍼디스크를 만드는 POST 요청을 작성합니다. name, sizeGb, type, provisionedIops, provisionedThroughput 속성을 포함합니다. 이 디스크를 비어 있고 포맷되지 않은 비부팅 디스크로 만들려면 소스 이미지 또는 소스 스냅샷을 지정하지 마세요.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks
    {
       "name": "DISK_NAME",
       "sizeGb": "DISK_SIZE",
       "type": "https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/diskTypes/DISK_TYPE",
       "provisionedIops": "IOPS_LIMIT",
       "provisionedThroughput": "THROUGHPUT_LIMIT",
       "accessMode": "DISK_ACCESS_MODE"
    }
    

    다음을 바꿉니다.

    • PROJECT_ID: 프로젝트 ID입니다.
    • ZONE: 인스턴스와 새 디스크가 배치되는 영역
    • DISK_NAME: 새 디스크의 이름
    • DISK_SIZE: 선택사항: 새 디스크의 크기입니다. 값은 정수이며 뒤에 크기 단위(기비바이트는 GB, 테비바이트는 TB)가 와야 합니다.
    • DISK_TYPE: 디스크 유형입니다. Hyperdisk 볼륨을 만들려면 hyperdisk-balanced, hyperdisk-extreme, hyperdisk-ml, hyperdisk-throughput 값 중 하나를 사용합니다.
    • IOPS_LIMIT: 선택사항: 하이퍼디스크 균형 및 하이퍼디스크 익스트림의 경우 디스크에서 처리할 수 있는 초당 I/O 작업 수입니다.
    • THROUGHPUT_LIMIT: 선택사항: Hyperdisk Balanced, Hyperdisk ML 또는 Hyperdisk Throughput 볼륨의 경우 디스크가 제공할 수 있는 최대 처리량(초당 MiB로 측정됨)을 나타내는 정수입니다.
    • DISK_ACCESS_MODE: 선택사항: 컴퓨팅 인스턴스가 디스크의 데이터에 액세스하는 방법입니다. 지원되는 값은 다음과 같습니다.

      • READ_WRITE_SINGLE: 한 인스턴스에서 읽기/쓰기 액세스를 위한 값입니다. 전역 window는 기본 설정이며,
      • READ_WRITE_MANY: 여러 인스턴스에서 동시에 읽기/쓰기 액세스가 가능한 경우(Hyperdisk Balanced 및 Hyperdisk Balanced 고가용성만 해당).
      • READ_ONLY_MANY: 여러 인스턴스에서 동시 읽기 전용 액세스가 가능한 경우(Hyperdisk ML만 해당)

      Hyperdisk Balanced 고가용성 디스크에 대한 액세스 모드를 설정하려면 리전 디스크 만들기를 참조하세요.

  2. 선택사항: compute.disks.get 메서드를 사용하여 디스크의 설명을 확인합니다.

  3. 디스크를 만든 후 실행 중이거나 중지된 인스턴스에 디스크를 연결할 수 있습니다.

Go

// createHyperdisk creates a new Hyperdisk in the specified project and zone.
func createHyperdisk(w io.Writer, projectId, zone, diskName string) error {
	//   projectID := "your_project_id"
	//   zone := "europe-central2-b"
	//   diskName := "your_disk_name"

	ctx := context.Background()
	client, err := compute.NewDisksRESTClient(ctx)
	if err != nil {
		return fmt.Errorf("NewDisksRESTClient: %v", err)
	}
	defer client.Close()

	// use format "zones/{zone}/diskTypes/(hyperdisk-balanced|hyperdisk-throughput)".
	diskType := fmt.Sprintf("zones/%s/diskTypes/hyperdisk-balanced", zone)

	// Create the disk
	disk := &computepb.Disk{
		Name:   proto.String(diskName),
		Type:   proto.String(diskType),
		SizeGb: proto.Int64(10),
		Zone:   proto.String(zone),
	}

	req := &computepb.InsertDiskRequest{
		Project:      projectId,
		Zone:         zone,
		DiskResource: disk,
	}

	op, err := client.Insert(ctx, req)
	if err != nil {
		return fmt.Errorf("Insert disk request failed: %v", err)
	}

	// Wait for the insert disk operation to complete
	if err = op.Wait(ctx); err != nil {
		return fmt.Errorf("unable to wait for the operation: %w", err)
	}

	fmt.Fprintf(w, "Hyperdisk created: %v\n", diskName)
	return nil
}

자바


import com.google.cloud.compute.v1.Disk;
import com.google.cloud.compute.v1.DisksClient;
import com.google.cloud.compute.v1.InsertDiskRequest;
import com.google.cloud.compute.v1.Operation;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class CreateHyperdisk {
  public static void main(String[] args)
          throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    // Project ID or project number of the Google Cloud project you want to use.
    String projectId = "YOUR_PROJECT_ID";
    // Name of the zone in which you want to create the disk.
    String zone = "europe-central2-b";
    // Name of the disk you want to create.
    String diskName = "YOUR_DISK_NAME";
    // The type of disk you want to create. This value uses the following format:
    // "zones/{zone}/diskTypes/(hyperdisk-balanced|hyperdisk-extreme|hyperdisk-throughput)".
    // For example: "zones/us-west3-b/diskTypes/hyperdisk-balanced"
    String diskType = String.format("zones/%s/diskTypes/hyperdisk-balanced", zone);
    // Size of the new disk in gigabytes.
    long diskSizeGb = 10;
    // Optional: For Hyperdisk Balanced or Hyperdisk Extreme disks,
    // this is the number of I/O operations per second (IOPS) that the disk can handle
    long provisionedIops = 3000;
    // Optional: For Hyperdisk Balanced or Hyperdisk Throughput volumes,
    // this is an integer that represents the throughput,
    // measured in MiB per second, that the disk can handle.
    long provisionedThroughput = 140;

    createHyperdisk(projectId, zone, diskName, diskType, diskSizeGb,
            provisionedIops, provisionedThroughput);
  }

  // Creates a hyperdisk in a project
  public static Disk createHyperdisk(String projectId, String zone, String diskName,
                                     String diskType, long diskSizeGb, long provisionedIops,
                                     long provisionedThroughput)
          throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests.
    try (DisksClient client = DisksClient.create()) {
      // Create a disk.
      Disk disk = Disk.newBuilder()
              .setZone(zone)
              .setName(diskName)
              .setType(diskType)
              .setSizeGb(diskSizeGb)
              .setProvisionedIops(provisionedIops)
              .setProvisionedThroughput(provisionedThroughput)
              .build();

      InsertDiskRequest request = InsertDiskRequest.newBuilder()
              .setProject(projectId)
              .setZone(zone)
              .setDiskResource(disk)
              .build();

      // Wait for the insert disk operation to complete.
      Operation operation = client.insertAsync(request).get(1, TimeUnit.MINUTES);

      if (operation.hasError()) {
        System.out.println("Disk creation failed!");
        throw new Error(operation.getError().toString());
      }

      // Wait for server update
      TimeUnit.SECONDS.sleep(10);

      Disk hyperdisk = client.get(projectId, zone, diskName);

      System.out.printf("Hyperdisk '%s' has been created successfully", hyperdisk.getName());

      return hyperdisk;
    }
  }
}

Node.js

// Import the Compute library
const computeLib = require('@google-cloud/compute');
const compute = computeLib.protos.google.cloud.compute.v1;

// Instantiate a diskClient
const disksClient = new computeLib.DisksClient();
// Instantiate a zoneOperationsClient
const zoneOperationsClient = new computeLib.ZoneOperationsClient();

/**
 * TODO(developer): Update/uncomment these variables before running the sample.
 */
// Project ID or project number of the Google Cloud project you want to use.
const projectId = await disksClient.getProjectId();

// The zone where your VM and new disk are located.
// zone = 'europe-central2-b';

// The name of the new disk
// diskName = 'disk-name';

// The type of disk. This value uses the following format:
// "zones/{zone}/diskTypes/(hyperdisk-balanced|hyperdisk-extreme|hyperdisk-ml|hyperdisk-throughput)".
// For example: "zones/us-west3-b/diskTypes/hyperdisk-balanced"
const diskType = `zones/${zone}/diskTypes/hyperdisk-balanced`;
// Size of the new disk in gigabytes.
const diskSizeGb = 10;
// Optional: For Hyperdisk Balanced or Hyperdisk Extreme disks,
// this is the number of I/O operations per second (IOPS) that the disk can handle.
const provisionedIops = 3000;
// Optional: For Hyperdisk Balanced or Hyperdisk Throughput volumes,
// this is an integer that represents the throughput,
// measured in MiB per second, that the disk can handle.
const provisionedThroughput = 140;

async function callCreateComputeHyperdisk() {
  // Create a disk
  const disk = new compute.Disk({
    sizeGb: diskSizeGb,
    name: diskName,
    zone,
    type: diskType,
    provisionedIops,
    provisionedThroughput,
  });

  const [response] = await disksClient.insert({
    project: projectId,
    zone,
    diskResource: disk,
  });

  let operation = response.latestResponse;

  // Wait for the create disk operation to complete.
  while (operation.status !== 'DONE') {
    [operation] = await zoneOperationsClient.wait({
      operation: operation.name,
      project: projectId,
      zone: operation.zone.split('/').pop(),
    });
  }

  console.log(`Disk: ${diskName} created.`);
}

await callCreateComputeHyperdisk();

디스크를 만든 후 실행 중이거나 중지된 인스턴스에 디스크를 연결할 수 있습니다.

디스크 포맷 및 마운트

새 디스크를 만들고 인스턴스에 연결한 후에는 운영체제가 가용 저장공간을 사용할 수 있도록 디스크를 포맷하고 마운트해야 합니다.

다음 단계