Skip to main content

Module device

Module device 

Source
Expand description

§Device management: adding, removing, and querying block devices in a filesystem

Covers adding and removing devices from a mounted filesystem, scanning a device to register it with the kernel, querying per-device I/O error statistics, and checking whether all devices of a multi-device filesystem are present and ready.

Most operations require CAP_SYS_ADMIN.

Structs§

DevInfo
Information about a single device within a btrfs filesystem, as returned by BTRFS_IOC_DEV_INFO.
DevStats
Per-device I/O error statistics, as returned by BTRFS_IOC_GET_DEV_STATS.

Enums§

DeviceSpec
Specifies a device for operations that can address by either path or ID.

Functions§

device_add
Add a device to the btrfs filesystem referred to by fd.
device_forget
Unregister a device (or all stale devices) from the kernel’s btrfs device scanner.
device_info
Query information about the device with the given devid on the filesystem referred to by fd.
device_info_all
Query information about all devices in the filesystem referred to by fd, using the device count from a previously obtained FsInfo.
device_ready
Check whether all member devices of the filesystem that contains path are available and the filesystem is ready to mount.
device_remove
Remove a device from the btrfs filesystem referred to by fd.
device_scan
Register a block device with the kernel’s btrfs device scanner so that multi-device filesystems containing it can be mounted.
device_stats
Query I/O error statistics for the device identified by devid within the filesystem referred to by fd.