<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZDiskImageStorageDeviceAttachment/init(url:readOnly:cachingMode:synchronizationMode:)-36gc5",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZDiskImageStorageDeviceAttachment(im)initWithURL:readOnly:cachingMode:synchronizationMode:error:"
  },
  "title" : "init(url:readOnly:cachingMode:synchronizationMode:)"
}
-->

# init(url:readOnly:cachingMode:synchronizationMode:)

Initialize the attachment from a local file URL.

```
init(url: URL, readOnly: Bool, cachingMode: VZDiskImageCachingMode, synchronizationMode: VZDiskImageSynchronizationMode) throws
```

## Parameters

`url`

Local file URL to the disk image in RAW format.

`readOnly`

If `true`, the device attachment is read-only, otherwise the device can write data to the disk image.

`cachingMode`

The cacheing mode from one of the available [`VZDiskImageCachingMode`](/documentation/Virtualization/VZDiskImageCachingMode) options.

`synchronizationMode`

How the disk image synchronizes with the underlying storage when the guest operating system flushes data, described by one of the available [`VZDiskImageSynchronizationMode`](/documentation/Virtualization/VZDiskImageSynchronizationMode) modes.

## Discussion

---

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)