---
name: "ioctl_xfs_verify_media"
section: "2"
platform: "linux"
package: "xfsprogs"
version: "7.2.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ioctl_xfs_verify_media"
---

# ioctl\_xfs\_verify\_media(2)

verify the media of the devices backing XFS

## NAME

ioctl\_xfs\_verify\_media - verify the media of the devices backing XFS

## SYNOPSIS

**#include \<xfs/xfs\_fs.h\>**

**int ioctl(int** *fd***, XFS\_IOC\_VERIFY\_MEDIA, struct xfs\_verify\_media \****arg***);**

## DESCRIPTION

Verify the media of a storage device backing an XFS filesystem. If errors are found, report the error to the kernel so that it can generate health events for the health monitoring system and fsnotify. The verification request is conveyed in a structure of the following form:

```
struct xfs_verify_media {
	__u32	me_dev;
	__u32	me_flags;
	__u64	me_start_daddr;
	__u64	me_end_daddr;
	__u32	me_ioerror;
	__u32	me_max_io_size;
	__u32	me_rest_us;
	__u32	me_pad;
};
```

The field *me\_pad* must be zero.

The field *me\_ioerror* will be set if the ioctl returns success.

The fields *me\_start\_daddr* and *me\_end\_daddr* are the range of the storage device to verify. Both values must be in units of 512-byte blocks. The *me\_start\_daddr* field is inclusive, and the *me\_end\_daddr* field is exclusive. If *me\_end\_daddr* is larger than the size of the device, the kernel will set it to the size of the device.

If the system call returns success and any part of the storage device range was successfully verified, the *me\_start\_daddr* field will be updated to reflect the successful verification. If after this update the *me\_start\_daddr* is equal to *me\_end\_daddr*, then the entire range was verified successfully.

If not, then a media error was encountered and the caller should generate a series of secondary calls to this ioctl with smaller ranges to discover the exact location and type of media error. The type of media error will be written to the *me\_ioerror* field.

The *me\_max\_io\_size* field, if nonzero, is an upper bound on the I/O operations that the kernel will issue to the block device.

The *me\_rest\_us* is the time duration, in microseconds, for which the kernel will wait between issuing I/O operations.

The field *me\_dev* must be one of the following values:

- **XFS\_DEV\_DATA**

  Verify the data device.

- **XFS\_DEV\_LOG**

  Verify the external log device.

- **XFS\_DEV\_RT**

  Verify the realtime device.

The field *me\_flags* is a bitmask of one of the following values:

- **XFS\_VERIFY\_MEDIA\_REPORT**

  Report all media errors to fsnotify.

The *me\_max\_io\_size* field, if nonzero, will be used as advice for the maximum size of the IO to send to the device.

The *me\_rest\_us* field will cause the kernel to pause for this many microseconds between IO requests.

## RETURN VALUE

On runtime error, -1 is returned, and *errno* is set to indicate the error. If 0 is returned, then *start\_daddr* or *ioerror* will be updated.

## ERRORS

Error codes can be one of, but are not limited to, the following:

- **EPERM**

  The calling process does not have sufficient privilege.

- **EINVAL**

  One or more of the arguments specified is invalid.

- **EFAULT**

  The *arg* structure could not be copied into the kernel.

- **ENODEV**

  The device is not present.

- **ENOMEM**

  There was not enough memory to perform the verification.

## I/O ERRORS

The *ioerror* field could be set to one of the following:

- **0**

  The verification I/O succeeded.

- **EOPNOTSUPP**

  - **ETIMEDOUT**

  The kernel timed out the verification I/O command.

- **ENOLINK**

  The transportation link to the storage device was down temporarily.

- **EREMOTEIO**

  The storage target controller suffered a critical error.

- **ENODATA**

  The storage target media suffered a critical error.

- **EILSEQ**

  Storage protection metadata did not validate successfully.

- **ENOMEM**

  There was not enough memory to allocate an I/O request.

- **ENODEV**

  The storage device is offline.

- **ETIME**

  The storage device timed out the I/O command.

- **EINVAL**

  The I/O request was rejected by the device for being invalid.

- **EIO**

  An I/O error occurred but no specific details are available.

This list is not exhaustive and may grow in the future.

## CONFORMING TO

This API is specific to XFS filesystem on the Linux kernel.

## SEE ALSO

[**ioctl\_xfs\_health\_monitor**(2)](/ioctl_xfs_health_monitor/2.md)
