I have a script that prepares some filesystems. It does something like this: cryptsetup open $dev temp ... mkfs.ext4 /dev/mapper/temp cryptsetup close temp But I get an error when closing: device-mapper: remove ioctl on temp failed: Device or resource busy I expect this is due to mkfs not having synced. Of course the same commands entered on the command-line work fine because they aren't executed as quickly. I've tried using sync to overcome this but it doesn't seem to work always. The thing that does work is 'sleep 1' but that's luck more than anything. It isn't just mkfs - I also prepare some devices using dd and that exhibits the same problem ( using conv=fsync with dd didn't help there either). Is there a proper way to ensure the device mapper is not being used before attempting to close it, or a way to force the close command to wait ? _______________________________________________ dm-crypt mailing list dm-crypt@xxxxxxxx https://www.saout.de/mailman/listinfo/dm-crypt