I am creating a partition with sfdisk under linux. After partition creation I want to create a filesystem.
This fails with mkfs.ext3 not finding the partition:
echo ",,L" | sfdisk $DEVICE mkfs.ext3 $PARTITION
But this works:
echo ",,L" | sfdisk $DEVICE sleep 1 mkfs.ext3 $PARTITION
I suspect, either the kernel takes some time to update it's internal data structures, or my script gets scheduled again, before udev had a chance to create the device node.
How do I wait exactly until the device node is created? With every constant time, there may be a system under load where this time is not eneugh.