---
name: "FS_IOC_SETFSLABEL"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/FS_IOC_SETFSLABEL"
---

# FS\_IOC\_SETFSLABEL(2const)

get or set a filesystem label

## NAME

FS\_IOC\_GETFSLABEL, FS\_IOC\_SETFSLABEL - get or set a filesystem label

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <linux/fs.h>  /* Definition of *FSLABEL* constants */
#include <sys/ioctl.h>
```

**int ioctl(int** *fd***, FS\_IOC\_GETFSLABEL, char** *label***\[FSLABEL\_MAX\]);** **int ioctl(int** *fd***, FS\_IOC\_SETFSLABEL, char** *label***\[FSLABEL\_MAX\]);**

## DESCRIPTION

If a filesystem supports online label manipulation, these [**ioctl**(2)](/ioctl/2.md) operations can be used to get or set the filesystem label for the filesystem on which *fd* resides. The **FS\_IOC\_SETFSLABEL** operation requires privilege (**CAP\_SYS\_ADMIN**).

## RETURN VALUE

On success zero is returned. On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

Possible errors include (but are not limited to) the following:

- **EFAULT**

  *label* references an inaccessible memory area.

- **EINVAL**

  The specified label exceeds the maximum label length for the filesystem.

- **ENOTTY**

  This can appear if the filesystem does not support online label manipulation.

- **EPERM**

  The calling process does not have sufficient permissions to set the label.

## STANDARDS

Linux.

## HISTORY

Linux 4.18.

They were previously known as **BTRFS\_IOC\_GET\_FSLABEL** and **BTRFS\_IOC\_SET\_FSLABEL** and were private to Btrfs.

## NOTES

The maximum string length for this interface is **FSLABEL\_MAX**, including the terminating null byte ('\\0'). Filesystems have differing maximum label lengths, which may or may not include the terminating null. The string provided to **FS\_IOC\_SETFSLABEL** must always be null-terminated, and the string returned by **FS\_IOC\_GETFSLABEL** will always be null-terminated.

## SEE ALSO

[**ioctl**(2)](/ioctl/2.md), [**blkid**(8)](/blkid/8.md)
