public sealed class AllocationPolicy.Types.Disk : IMessage<AllocationPolicy.Types.Disk>, IEquatable<AllocationPolicy.Types.Disk>, IDeepCloneable<AllocationPolicy.Types.Disk>, IBufferMessage, IMessage
Reference documentation and code samples for the Batch v1alpha API class AllocationPolicy.Types.Disk.
Non-Boot Disk:
If the type specifies a persistent disk, this field
is ignored if data_source is set as image or snapshot.
If the type specifies a local SSD, this field should be a multiple of
375 GB, otherwise, the final size will be the next greater multiple of
375 GB.
Boot Disk:
Batch will calculate the boot disk size based on source
image and task requirements if you do not speicify the size.
If both this field and the boot_disk_mib field in task spec's
compute_resource are defined, Batch will only honor this field.
Also, this field should be no smaller than the source disk's
size when the data_source is set as snapshot or image.
For example, if you set an image as the data_source field and the
image's default disk size 30 GB, you can only use this field to make the
disk larger or equal to 30 GB.
Disk type as shown in gcloud compute disk-types list.
For example, local SSD uses type "local-ssd".
Persistent disks and boot disks use "pd-balanced", "pd-extreme", "pd-ssd"
or "pd-standard". If not specified, "pd-standard" will be used as the
default type for non-boot disks, "pd-balanced" will be used as the
default type for boot disks.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eAllocationPolicy.Types.Disk\u003c/code\u003e class represents a new persistent disk or local SSD for the Batch v1alpha API, with VMs being limited to one local SSD setting but capable of having multiple local SSD partitions.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and inherits from the base \u003ccode\u003eobject\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDataSourceCase\u003c/code\u003e property determines whether an image or snapshot is the data source, while \u003ccode\u003eDiskInterface\u003c/code\u003e allows specification of the interface, with "NVMe" being the default for local SSDs.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSizeGb\u003c/code\u003e property specifies the disk size in gigabytes, with different behaviors for boot disks vs non-boot disks, and for local SSD's, the size should be a multiple of 375 GB, else it will be rounded to the next multiple.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eType\u003c/code\u003e property allows users to set the disk type such as local-ssd, pd-balanced, pd-extreme, pd-ssd or pd-standard; default is set to "pd-standard" for non-boot disks and "pd-balanced" for boot disks if no other type is specified.\u003c/p\u003e\n"]]],[],null,["# Batch v1alpha API - Class AllocationPolicy.Types.Disk (1.0.0-alpha31)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.0-alpha31 (latest)](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types.Disk)\n- [1.0.0-alpha30](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/1.0.0-alpha30/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types.Disk) \n\n public sealed class AllocationPolicy.Types.Disk : IMessage\u003cAllocationPolicy.Types.Disk\u003e, IEquatable\u003cAllocationPolicy.Types.Disk\u003e, IDeepCloneable\u003cAllocationPolicy.Types.Disk\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Batch v1alpha API class AllocationPolicy.Types.Disk.\n\nA new persistent disk or a local ssd.\nA VM can only have one local SSD setting but multiple local SSD partitions.\nSee \u003chttps://cloud.google.com/compute/docs/disks#pdspecs\u003e and\n\u003chttps://cloud.google.com/compute/docs/disks#localssds\u003e. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AllocationPolicy.Types.Disk \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[AllocationPolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types.Disk), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AllocationPolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types.Disk), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[AllocationPolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.AllocationPolicy.Types.Disk), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Batch.V1Alpha](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha)\n\nAssembly\n--------\n\nGoogle.Cloud.Batch.V1Alpha.dll\n\nConstructors\n------------\n\n### Disk()\n\n public Disk()\n\n### Disk(Disk)\n\n public Disk(AllocationPolicy.Types.Disk other)\n\nProperties\n----------\n\n### DataSourceCase\n\n public AllocationPolicy.Types.Disk.DataSourceOneofCase DataSourceCase { get; }\n\n### DiskInterface\n\n public string DiskInterface { get; set; }\n\nLocal SSDs are available through both \"SCSI\" and \"NVMe\" interfaces.\nIf not indicated, \"NVMe\" will be the default one for local ssds.\nThis field is ignored for persistent disks as the interface is chosen\nautomatically. See\n\u003chttps://cloud.google.com/compute/docs/disks/persistent-disks#choose_an_interface\u003e.\n\n### HasImage\n\n public bool HasImage { get; }\n\nGets whether the \"image\" field is set\n\n### HasSnapshot\n\n public bool HasSnapshot { get; }\n\nGets whether the \"snapshot\" field is set\n\n### Image\n\n public string Image { get; set; }\n\nURL for a VM image to use as the data source for this disk.\nFor example, the following are all valid URLs:\n\n- Specify the image by its family name: projects/{project}/global/images/family/{image_family}\n- Specify the image version: projects/{project}/global/images/{image_version}\n\nYou can also use Batch customized image in short names.\nThe following image values are supported for a boot disk:\n\n- `batch-debian`: use Batch Debian images.\n- `batch-cos`: use Batch Container-Optimized images.\n- `batch-hpc-rocky`: use Batch HPC Rocky Linux images.\n\n### SizeGb\n\n public long SizeGb { get; set; }\n\nDisk size in GB.\n\n**Non-Boot Disk** :\nIf the `type` specifies a persistent disk, this field\nis ignored if `data_source` is set as `image` or `snapshot`.\nIf the `type` specifies a local SSD, this field should be a multiple of\n375 GB, otherwise, the final size will be the next greater multiple of\n375 GB.\n\n**Boot Disk** :\nBatch will calculate the boot disk size based on source\nimage and task requirements if you do not speicify the size.\nIf both this field and the `boot_disk_mib` field in task spec's\n`compute_resource` are defined, Batch will only honor this field.\nAlso, this field should be no smaller than the source disk's\nsize when the `data_source` is set as `snapshot` or `image`.\nFor example, if you set an image as the `data_source` field and the\nimage's default disk size 30 GB, you can only use this field to make the\ndisk larger or equal to 30 GB.\n\n### Snapshot\n\n public string Snapshot { get; set; }\n\nName of a snapshot used as the data source.\nSnapshot is not supported as boot disk now.\n\n### Type\n\n public string Type { get; set; }\n\nDisk type as shown in `gcloud compute disk-types list`.\nFor example, local SSD uses type \"local-ssd\".\nPersistent disks and boot disks use \"pd-balanced\", \"pd-extreme\", \"pd-ssd\"\nor \"pd-standard\". If not specified, \"pd-standard\" will be used as the\ndefault type for non-boot disks, \"pd-balanced\" will be used as the\ndefault type for boot disks."]]