IOCTL-XFS-VERIFY-MEDIA(2)
β¨ ioctl_xfs_verify_media β verify the media of the devices backing XFS β¨
okay bestie, so this one lives in the System Calls Manual section (section 2, for the uninitiated π ) and it's literally the vibe check for the physical storage underneath your XFS filesystem. sit down, grab a strawberry drink π, and let's get into it.
πΈ 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 β¨
So what you're doing here is verifying the media of a storage device backing an XFS filesystem. And if errors pop up? You report them to the kernel, so it can generate health events for the health monitoring system and fsnotify. no cap, the kernel is the one keeping receipts π.
The verification request travels inside a structure that looks exactly like this:
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. not negotiable, don't be chaotic.
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. it's giving "the kernel corrects you, lovingly".
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. think of it like zooming in on a blurry photo until you find the cursed pixel π.
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. yes, the kernel takes little breaks. self-care king π.
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. periodt.
π 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β Theargstructure 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.EOPNOTSUPPETIMEDOUTβ 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. so don't come for me if new ones show up π.
π§ CONFORMING TO π§
This API is specific to XFS filesystem on the Linux kernel. it does not play well with others, it's loyal like that π.
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie β¨ this was XFS, dated 2026-01-09, and yeah β that's the version, that's the source, that's the tea π slay, go verify some media, i'm obsessed π
π¦ where this page comes from
- alpine 3.24: xfsprogs-doc 7.0.1-r0 Β· LGPL-2.1-or-later
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- nixpkgs unstable: xfsprogs 7.2.1
- π the page's license: GPL-2.0+
- Copyright (c) 2025-2026, Oracle. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms