Need help with ESXi kickstart script for automated scripted install

I am installing ESXi with an automated usb install via a kickstart script. The ks.cfg file is as the one listed below.
As of now, the installer installs the ESXi on the USB drive that I use for booting and installing. Seems like the installer doesn't find the RAID5 storage that the host has and chooses the usb instead. I am lalso assuming that the clearpart line below is clearing all available disks, including the usb disk. I don't want that.

Any suggestions?

clearpart --alldrives --overwritevmfs  
install --firstdisk=local --overwritevmfs
rootpw dposdpos
network --bootproto=static --device=vmnic0 --addvmportgroup=0 --ip= --netmask= --gateway= --hostname=AB-ESXiHost1 --vlanid=100 --nameserver=

%post --interpreter=busybox --ignorefailure=true
#Get the config file:
cd /ovf
#Using test configuration(test-config.txt) until later - so this is commented out:
#wget --user=user--password=Secret1

# Gather information from configuration file:
ESXiHostname=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f1`
ESXiIpAddress=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f2`
ESXiSubnet=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f3`
ESXiGateway=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f4`
ESXiSubnetID=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f5`
ESXiVLAN=`more /ovf/test-config.txt | grep esx1 | cut -d';' -f6`

# Set the IP address configuration on the host:
esxcli system hostname set --host=$ESXiHostname
esxcli network ip interface ipv4 set --interface-name vmnic0 --type static --ipv4 $ESXiIpAddress --netmask $ESXiSubnet
esxcli network vswitch standard portgroup set -p "Management Network" --vlan-id $ESXiVLAN
esxcli network ip route ipv4 add --gateway $ESXiGateway --network $ESXiSubnetID

# Set route as a permament route:

# Copy the ovf tool to the correct location:
cp -R /ovf /vmfs/volumes/datastore1/

esxcli system shutdown reboot -d 120 -r "Host post install setup done! Rebooting.."

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
is your RAID 5 storage controller, on the HCL, and already presented to the OS, as a RAID 5 volume ? (virtual disk, or logical disk)

have you tried also changing the order, it tries to install to storage

--firstdisk(=<disk-type1>,[<disk-type2>, ...])

Partitions the first eligible disk found. The order of the eligible disks is set to:

1 locally attached storage (local)
2 network storage (remote)
3 usb disks (usb)
You can change the ordering of the disks by using a comma separated list appended to the argument.

see here

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
itniflAuthor Commented:
I have been struggling with this setting (--firstdisk) in various ways now. Tried it these ways:
And now testing:

p420i is the raid controller that the raid5 volume is on.
I have deleted the raid 5 disk and set it up again. According to the documentation, this is exactly what they do when the host is installed manually. I will try to install it again with the last mentioned setting above, see if I can find some log files and then perhaps try to install manually to see if the disk raid array is discovered then.

I also have the option of specifying the disk to use --disk=identifier
But I am not sure what identifier that would be or where to find it. And also I suppose this identifier is different from system to system, even if all the hosts are HP G8? So no real point in using it, I guess.
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
it's the disk identifier, you can see when ESXi is installed.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

itniflAuthor Commented:
OK thanks. Looks like the usb disk is being listed as first available local storage. I found this when I booted with a regular installer. I have no idea why it is not being listed as usb storage. Because it is taking the place as first local storage, the real first local storage is not being used. I can see that the real local storage is labeled as HP iLO. I guess I will try to use --firstdrive=HP, or could I use the identifier that is shown there not only on this systems, but all systems?

Listed as local storage
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
what is the boot order on the server set to?
itniflAuthor Commented:
It is set to "External DriveKeys First" - change it and explicitly choose to boot from usb at startup instead of automatically?
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
it's a bit odd, it states remote ?
itniflAuthor Commented:
Yes, the RAID states as remote. The internal SD card that is almost 8 GB states as local number two. I guess on second thought that I should be using the local SD card for the ESXi install and the raid for a datastore.
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
I would recommend the use of an SD card or USB flash drive for installation of the OS.

It's much easier to expand a datastore, when it just has a VMFS datastore, and not combined with the OS.
itniflAuthor Commented:
Yes, absolutely. I misunderstood the initial setup, SD card it is!
Right before I left work yesterday, It seemed as if the following was functional and did what I wanted:
clearpart --firstdisk=HP --overwritevmfs  
install --firstdisk=HP --overwritevmfs

Open in new window

Here the SD card is chosen, since it is the first local storage with the vendor name HP.
I will look further into the boot sequence and why the usb drive is listed as local storage.
I would like to clear all partitions on all drives except the USB drive. I am assuming that clearpart --alldrives --overwritevmfs also clears the USB drive since it is listed as local storage. I guess I could use --ignoredrives=, but I would not know what to identify the USB with. I am also unsure if that identifier changes if a different USB stick is used a different time for the installation process.
itniflAuthor Commented:
Looks like things are working as they should with:
clearpart --firstdisk=HP --overwritevmfs  
install --firstdisk=HP --overwritevmfs
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.