<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolume/RenameHandler/setVolumeName(_:context:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSVolumeRenameHandler(im)setVolumeName:context:replyHandler:"
  },
  "title" : "setVolumeName(_:context:replyHandler:)"
}
-->

# setVolumeName(_:context:replyHandler:)

Sets a new name for the volume.

```
func setVolumeName(_ name: FSFileName, context: FSContext, replyHandler reply: @escaping @Sendable (FSVolumeRenameResult?, (any Error)?) -> Void)
```

```
func setVolumeName(_ name: FSFileName, context: FSContext) async throws -> FSVolumeRenameResult
```

## Parameters

`name`

The new volume name.

`context`

An object that enables context-aware file system decisions throughout the operation.

`reply`

A block or closure to indicate success or failure. If renaming succeeds, pass an instance of [`FSVolumeRenameResult`](/documentation/FSKit/FSVolumeRenameResult) containing the [`FSFileName`](/documentation/FSKit/FSFileName) of the new volume name, along with a `nil` error. If renaming fails, pass the relevant error as the second parameter; FSKit ignores the [`FSVolumeRenameResult`](/documentation/FSKit/FSVolumeRenameResult) instance in this case. For an `async` Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

---

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)