<!--
{
  "availability" : [
    "macOS: 12.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZVirtioBlockDeviceConfiguration/blockDeviceIdentifier",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZVirtioBlockDeviceConfiguration(py)blockDeviceIdentifier"
  },
  "title" : "blockDeviceIdentifier"
}
-->

# blockDeviceIdentifier

The string that identifies the VIRTIO block device.

```
var blockDeviceIdentifier: String { get set }
```

## Discussion

Use `blockDeviceIdentifier` to name devices so they’re more discoverable in the Linux guest. The identifier must be an ASCII encodable string of 20 bytes or less.

Validate the identifier string using [`validateBlockDeviceIdentifier(_:)`](/documentation/Virtualization/VZVirtioBlockDeviceConfiguration/validateBlockDeviceIdentifier(_:)) before attempting to set this property, for example:

```swift
let idString = "ProjectData"
do {
    try VZVirtioBlockDeviceConfiguration.validateBlockDeviceIdentifier(idString)
    blockDeviceIdentifier = idString
} catch {
    // Handle error as appropriate.
    throw error
}
```

> Warning:
> Setting the identifier to an invalid string results in a fatal error that terminates the app.

In a Linux guest, device identifiers are visible in the `/dev/disk/by-id/` directory.

---

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)