pub fn replace_start(
fd: BorrowedFd<'_>,
source: ReplaceSource<'_>,
tgtdev_path: &CStr,
avoid_srcdev: bool,
) -> Result<Result<(), ReplaceStartError>>Expand description
Start a device replace operation, copying all data from source to the
target device at tgtdev_path.
When avoid_srcdev is true, the kernel will only read from the source
device when no other zero-defect mirror is available (useful for replacing
a device with known read errors).
Returns a two-level Result: the outer nix::Result covers ioctl-level
failures (EPERM, EINVAL, etc.), while the inner Result covers
application-level rejections reported by the kernel in the result field.
Ok(Ok(())) means the replace started successfully.
Ok(Err(AlreadyStarted)) means another replace is in progress.
Ok(Err(ScrubInProgress)) means a scrub must finish or be cancelled first.
Errors: ENAMETOOLONG if source or target device paths exceed the kernel buffer size.