pub fn device_remove(fd: BorrowedFd<'_>, spec: DeviceSpec<'_>) -> Result<()>Expand description
Remove a device from the btrfs filesystem referred to by fd.
The device can be specified either by path or by its btrfs device ID via
DeviceSpec. Uses BTRFS_IOC_RM_DEV_V2 and falls back to the older
BTRFS_IOC_RM_DEV ioctl on kernels that do not support the v2 variant
(only possible when removing by path). The kernel requires CAP_SYS_ADMIN.
Errors: ENOTTY or EOPNOTSUPP from RM_DEV_V2 triggers an automatic
fallback to the v1 ioctl (path-based removal only; by-ID removal
requires v2 and will propagate the error). EBUSY if the device holds
the only copy of some data and cannot be removed.