<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSBlockDeviceResource/delayedMetadataWriteFrom:startingAt:length:error:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(cs)FSBlockDeviceResource(im)delayedMetadataWriteFrom:startingAt:length:error:"
  },
  "title" : "delayedMetadataWriteFrom:startingAt:length:error:"
}
-->

# delayedMetadataWriteFrom:startingAt:length:error:

Writes file system metadata from a buffer to a cache, prior to flushing it to the resource.

```
- (BOOL) delayedMetadataWriteFrom:(void *) buffer startingAt:(off_t) offset length:(size_t) length error:(NSError **) error;
```

## Parameters

`buffer`

A buffer to provide the data.

`offset`

The offset into the resource from which to start writing.

`length`

The number of bytes to writing.

`error`

On return, any error encountered while writing data, or `nil` if no error occurred.

## Return Value

A Boolean value indicating whether the metadata write succeeded.

## Discussion

This method provides access to the Kernel Buffer Cache, which is the primary system cache for file system metadata.
Unlike equivalent kernel APIs, this method doesn’t hold any kernel-level claim to the underlying buffers.

This method is equivalent to [`metadataWriteFrom:startingAt:length:error:`](/documentation/FSKit/FSBlockDeviceResource/metadataWriteFrom:startingAt:length:error:), except that it writes data to the resource’s buffer cache instead of writing to disk immediately.
To ensure writing data to disk, the client must flush the metadata by calling [`metadataFlush()`](/documentation/FSKit/FSBlockDeviceResource/metadataFlush()) or [`asynchronousMetadataFlush()`](/documentation/FSKit/FSBlockDeviceResource/asynchronousMetadataFlush()).

Delayed writes offer two significant advantages:

- Delayed writes are more performant, since the file system can avoid waiting for the actual write, reducing I/O latency.
- When writing to a specific range repeatedly, delayed writes allow the file system to flush data to the disk only when necessary. This reduces disk usage by eliminating unnecessary writes.

For the write to succeed, requests must conform to any transfer requirements of the underlying resource.
Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.

> Important: The Kernel Buffer Cache is keyed by offset alone and doesn’t detect overlapping byte ranges between buffers. As a result, the byte ranges of any two metadata operations must never intersect. All accesses to a given disk region must use the same (offset, length) pair.

---

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)