I currently have a logic to wait for the resync process to finish by looking at /sys/block/mdXXX/md/raid_state
to be clean
and assume that the resync has finished. However, I don't think this is correct as the raid can be in clean state while the resync is still happening.
What is a guaranteed way to ensure that newly created raid1 array using mdadm has fully completed the resync process?
Does mdadm have an inbuilt way of specifying whether we want to wait for resync to finish or not?
I have a Rust program that is orchestrating RAID creation using mdadm.
// above create RAID-1 using mdadm --create
loop {
let raid_state = read_file("/sys/block/mdXXX/md/raid_state")
let sync_complete = raid_state == RaidState::Clean;
if sync_complete {
// do more
}
}