---
title: "init(url:readOnly:cachingMode:synchronizationMode:)"
framework: virtualization
role: symbol
role_heading: Initializer
path: "virtualization/vzdiskimagestoragedeviceattachment/init(url:readonly:cachingmode:synchronizationmode:)-36gc5"
---

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

Initialize the attachment from a local file URL.

## Declaration

```swift
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 doc://com.apple.virtualization/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 doc://com.apple.virtualization/documentation/Virtualization/VZDiskImageSynchronizationMode modes.

## See Also

### Creating the attachment point

- [init(url:readOnly:)](virtualization/vzdiskimagestoragedeviceattachment/init(url:readonly:)-9qeco.md)
