#!/bin/sh

. /opt/hmc/bin/functions
# Check to see if disk is previously
# used with non Linux partitions
init_dd=0
fdisk -l /dev/${HD} | grep -q Linux
if [ $? -ne 0 ]; then
# Destroy partition table
  dd if=/dev/zero of=/dev/${HD} bs=1024 count=2
  init_dd=1
fi

HD=$(/opt/hmc/bin/getHDName)
echo "Initializing disk (${HD})." | cut -b1-50
CreateDisk

# Once dd is issued, need to force kernel to
# re-read partition table
if [ $init_dd -eq 1 ]; then
  partprobe /dev/${HD}
fi

exit 0
