5
1
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.
If the whole disk is encrypted, you may not be able to tell.
– Kamil Maciorowski – 2018-04-25T13:02:12.750I think that the answer will involve scripting dd to peek at the partition table. Maybe someone familiar with the partition table data would like to weigh in with a scripted answer?
– zero2cx – 2012-09-07T17:09:18.313