in reply to Need Advice on Folder/Drive locking

I wouldn't create the temp file on the target but under (say) /var/run or /tmp or some other central location for the machine, and use a filename derived from the name of the target device, but other than that, I don't see any other effective approach.