IOCTL-XFS-VERIFY-MEDIA(2) System Calls Manual IOCTL-XFS-VERIFY-MEDIA(2)

ioctl_xfs_verify_media - verify the media of the devices backing XFS

#include <xfs/xfs_fs.h>

int ioctl(int fd, XFS_IOC_VERIFY_MEDIA, struct xfs_verify_media *arg);

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:

Verify the data device.
Verify the external log device.
Verify the realtime device.

The field me_flags is a bitmask of one of the following values:

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.

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.

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

The calling process does not have sufficient privilege.
One or more of the arguments specified is invalid.
The arg structure could not be copied into the kernel.
The device is not present.
There was not enough memory to perform the verification.

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

0
The verification I/O succeeded.
The kernel timed out the verification I/O command.
The transportation link to the storage device was down temporarily.
The storage target controller suffered a critical error.
The storage target media suffered a critical error.
Storage protection metadata did not validate successfully.
There was not enough memory to allocate an I/O request.
The storage device is offline.
The storage device timed out the I/O command.
The I/O request was rejected by the device for being invalid.
An I/O error occurred but no specific details are available.

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

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

ioctl_xfs_health_monitor(2)

2026-01-09 XFS