<!--
{
  "availability" : [
    "macOS: 12.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZVirtioBlockDeviceConfiguration/validateBlockDeviceIdentifier(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZVirtioBlockDeviceConfiguration(cm)validateBlockDeviceIdentifier:error:"
  },
  "title" : "validateBlockDeviceIdentifier(_:)"
}
-->

# validateBlockDeviceIdentifier(_:)

Checks the validity of a block device identifier.

```
class func validateBlockDeviceIdentifier(_ blockDeviceIdentifier: String) throws
```

## Parameters

`blockDeviceIdentifier`

The device identifier to validate. In the case of an invalid identifier string, the method throws an error that describes why the device identifier isn’t valid.

## Discussion

Use [`validateBlockDeviceIdentifier(_:)`](/documentation/Virtualization/VZVirtioBlockDeviceConfiguration/validateBlockDeviceIdentifier(_:)) to validate an identifier string before trying to set the [`blockDeviceIdentifier`](/documentation/Virtualization/VZVirtioBlockDeviceConfiguration/blockDeviceIdentifier) property. The identifier must be an ASCII encodable string of 20 bytes or less.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)