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 v1 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 latest version of the \u003ccode\u003eAllocationPolicy.Types.Disk\u003c/code\u003e class is 2.13.0, with documentation available for multiple previous versions dating back to 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAllocationPolicy.Types.Disk\u003c/code\u003e class represents a persistent disk or a local SSD for use in virtual machines within the Google Cloud Batch service.\u003c/p\u003e\n"],["\u003cp\u003eThe class inherits from the base \u003ccode\u003eobject\u003c/code\u003e class and 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.\u003c/p\u003e\n"],["\u003cp\u003eIt offers properties such as \u003ccode\u003eDataSourceCase\u003c/code\u003e, \u003ccode\u003eDiskInterface\u003c/code\u003e, \u003ccode\u003eImage\u003c/code\u003e, \u003ccode\u003eSizeGb\u003c/code\u003e, \u003ccode\u003eSnapshot\u003c/code\u003e, and \u003ccode\u003eType\u003c/code\u003e to define the characteristics and data sources of the disk.\u003c/p\u003e\n"],["\u003cp\u003ePersistent disks, boot disks, and local SSDs are all supported, each with their own specific requirements and defaults in the fields such as disk type and size.\u003c/p\u003e\n"]]],[],null,["# Batch v1 API - Class AllocationPolicy.Types.Disk (2.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.0 (latest)](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.12.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.11.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.10.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.9.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.8.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.7.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.6.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.5.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.4.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.3.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.2.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.1.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.0.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.3.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.2.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.1.0/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.0.0/Google.Cloud.Batch.V1.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 v1 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.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy.Types.Disk), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AllocationPolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.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.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy)[Types](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.AllocationPolicy.Types)[Disk](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.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.V1](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Batch.V1.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."]]