<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSBlockDeviceResource/metadataRead(into:startingAt:length:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "s:So21FSBlockDeviceResourceC5FSKitE12metadataRead4into10startingAt6lengthySw_s5Int64VSitKF"
  },
  "title" : "metadataRead(into:startingAt:length:)"
}
-->

# metadataRead(into:startingAt:length:)

Synchronously reads file system metadata from the resource into a buffer.

```
func metadataRead(into buffer: UnsafeMutableRawBufferPointer, startingAt offset: off_t, length: Int) throws
```

## Parameters

`buffer`

A buffer to receive the data.

`offset`

The offset into the resource from which to start reading.

`length`

The number of bytes to read.

## 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.

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

This method doesn’t support partial reading of metadata.

> Throws: Any error encountered while reading data.

---

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)