---
title: VZDiskBlockDeviceStorageDeviceAttachment
framework: virtualization
role: symbol
role_heading: Class
path: virtualization/vzdiskblockdevicestoragedeviceattachment
---

# VZDiskBlockDeviceStorageDeviceAttachment

A storage device attachment that uses a disk to store data.

## Declaration

```swift
class VZDiskBlockDeviceStorageDeviceAttachment
```

## Overview

Overview The disk block device implements a storage attachment by using an actual disk rather than a disk image on a file system. warning: Handle the disk passed to this attachment with caution. If the disk has a file system formatted on it, the guest can destroy data in a way that isn’t recoverable. In the following example, a disk device at /dev/rdisk42 executes the I/O operations directly on that disk rather than through a file system: By default, only the root user can access the disk file handle. Running virtual machines as root isn’t recommended. The best practice is to open the file in a separate process that has root privileges, then pass the open file descriptor using XPC or a Unix socket to a non-root process running Virtualization. For more information about Unix sockets, see Streams, Sockets, and Ports; for more information on XPC services, see the XPC framework documentation. important: You can’t use this method of privilege escalation in apps distributed on the Mac App Store.

## Topics

### Initializers

- [init(fileHandle:readOnly:synchronizationMode:)](virtualization/vzdiskblockdevicestoragedeviceattachment/init(filehandle:readonly:synchronizationmode:).md)

### Getting the block storage device details

- [fileHandle](virtualization/vzdiskblockdevicestoragedeviceattachment/filehandle.md)
- [isReadOnly](virtualization/vzdiskblockdevicestoragedeviceattachment/isreadonly.md)
- [synchronizationMode](virtualization/vzdiskblockdevicestoragedeviceattachment/synchronizationmode.md)

## Relationships

### Inherits From

- [VZStorageDeviceAttachment](virtualization/vzstoragedeviceattachment.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Related Documentation

- [VZVirtioBlockDeviceConfiguration](virtualization/vzvirtioblockdeviceconfiguration.md)

### Attachment points

- [VZDiskImageStorageDeviceAttachment](virtualization/vzdiskimagestoragedeviceattachment.md)
- [VZNetworkBlockDeviceStorageDeviceAttachment](virtualization/vznetworkblockdevicestoragedeviceattachment.md)
- [VZStorageDeviceAttachment](virtualization/vzstoragedeviceattachment.md)
