In conjunction with the customized PXE process I wrote about previously, it could be highly desirable to be able to return a server to the unprovisioned server pool in HP’s Server Automation.
This is a specifically-Linux procedure: though I’m sure something similar can be done with Windows*.
run an ad-hoc script against a target server that contains the following:
dd if=/dev/zero of=/dev/sda bs=512 count=1
sleep 1
nohup rebootThis will erase the MBR and partition table, and then reboot the server.
Before it reboots, however, you need to deactivate and delete the server from SA – otherwise it will not register correctly.
If you’ve already enabled (or not disabled) PXE booting, when it reboots, it will pick the default entry off the PXE menu, skipping the hard drive as there is no valid boot record available to it.
Why would you want to do this?
Well, let’s say you’re doing a lot of build testing (verifying ks.cfg or unattend.xml files, for example) – this could be useful.
Or, maybe you want to get your build process completely streamlined and you’re working with the MBC functionality in SA – again, rapid recycling of machines is highly desirable.
In a later post I’ll discuss freeing the VM from SA in the process (ie, removing it from the ESXi host to fully release resources).
*In fact, you may be able to run fdisk /mbr
on a Windows server – but I haven’t tried.