VMware ESXi CentOS 6.4 kickstart installation

centos6installationkickstartvmware-esxi

I was trying to do a kickstart installation for CentOS 6.4 but it always show me a warning of re-initializing the HDD as it say may contain invalid partition table or a virtual disk.
I have added below is the snapshot of the kickstart file I am trying to use

# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"
autopart
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel --drives=sda
part /boot --fstype ext4 --size=300
part / --fstype="ext4" --grow --size=1 --asprimary

Even I have created partitions to try as workaround but no resort. Any thoughts how to make this warning go away.
I am trying to do this through Packer-tools for ESXI host (which has 5.5 version) running.
Below is the JSON template I am using

# cat base-packer.json
{
  "builders": [
    {
      "vm_name": "Centos6.5",
      "type": "vmware-iso",
      "iso_url": "http://127.0.0.1:8000/CentOS-6.5-x86_64-minimal.iso",
      "iso_checksum": "0d9dc37b5dd4befa1c440d2174e88a87",
      "iso_checksum_type": "md5",
      "disk_size": "20480",
      "disk_type_id": "thin",
      "http_directory": "~/packertemplatebuilding",
      "remote_host": "191.168.42.3",
      "remote_datastore": "52dfe32b-a996d262-9b46-2c4138a85a23/Centos6.5",
      "remote_username": "root",
      "remote_password": "rootpass",
      "remote_type": "esx5",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "250s",
      "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
      "headless": "false",
      "boot_command": [
        "<tab> text ks=http://148.147.206.152:8000/ks_new.cfg<enter><wait>"
      ],
      "boot_wait": "20s",
      "vmx_data": {
        "ethernet0.virtualDev": "vmxnet3",
        "ethernet0.networkName": "VM Network",
        "ethernet0.addressType": "generated",
        "ethernet0.present": "TRUE",
        "ethernet1.virtualDev": "vmxnet3",
        "ethernet1.networkName": "VM Network 2",
        "ethernet1.addressType": "generated",
        "ethernet1.present": "TRUE",
        "ide0:0.fileName": "disk.vmdk",
        "ide0:0.present": "TRUE",
        "ide0:0.redo": "",
        "scsi0:0.present": "FALSE",
        "memsize": "2048",
        "numvcpus": "2",
        "cpuid.coresPerSocket": "1"
      }
    }
  ],
"provisioners": [
    {
      "type": "shell",
      "script": "ssh-commands.sh"
    }
  ]
}

Below is the snapshot of the error I am getting.
enter image description here

PS The image I am using is a custom spin from CentOS 6.4. But I don't think that kickstart config should have an impact on the same.

Best Answer

If you're receiving an error message similar to the following in your EL6 kickstart, you'll need to add zerombr to the kickstart command set.

You should also have this instead:

zerombr
clearpart --all --initlabel

enter image description here

From the documentation:

zerombr: If zerombr is specified any invalid partition tables found on disks are initialized. This destroys all of the contents of disks with invalid partition tables. This command is required when performing an unattended installation on a system with previously initialized disks.

Edit:

I just tried this on a fresh CentOS EL6.5 virtual machine running on a vSphere 5.5 platform... The following worked three times in succession without issue, including a reinstallation on the same disks:

zerombr
clearpart --all --initlabel
part /boot --fstype ext4 --size=300
part /usr --fstype ext4 --size=10240 --asprimary
part / --fstype ext4 --size=20480 --asprimary
part /var --fstype ext4 --size=6144
part swap --size=8192
part /tmp --fstype ext4 --size=2048