I'm currently working on a DIY network storage which aggregates free disk space using mhddfs.
Now what I want is, for example given a hotswap bay, when I insert a brand new unpartitioned disk, I wish to automatically partition the disk using a bash script and mount the new mhddfs partition.
The same situation occurs if the server is turned off, new disk gets inserted and the server is turned on again.
So the question is: How can i detect an unpartitioned disk using a bash script?
The question also includes that there should be no false detections. e.g. if an encrypted disk is inserted, it shouldn't be automatically repartitioned and formated - This point is the main interest in the question.