I recently came across a very useful tidbit after receiving several
inquires asking how to configure an Apple Mac Mini to automatically
startup after a power failure. This is extremely useful for situations
where power is eventually restored and you are not physically around to
press the power button. Automatically starting up after a power failure
is not a new feature of the Mac Mini and it actually exists on most
modern day systems and can be configured using a variety of tools.
The challenge arises when you are running ESXi, how do you go about
enabling this functionality in ESXi itself? Well the answer is actually
quite simple, you can enable this outside of ESXi. Normally to enable
this feature you can either run a setpci command on UNIX/Linux system or
configure the energy saver settings in OS X. Several folks from the
VMTN community such as zippytiff and twuhabro
have already confirmed having success using the latter option when
booting OS X off a USB or SD card to modify the energy saving settings.
I finally got a chance to look into this a bit more for myself and with a
bit of research, I found several other methods which also works and may
potentially be easier.
Note: I have heard that
historically the auto startup flag has not persisted in older Apple
hardware, but for the new Mac Mini 5,3 and 6,2, they seem to be
persisting without any issue from my testing. YMMV depending on your
hardware and/or firmware.
Method 1 (Configure in OS X)
If you already have OS X install on your Mac Mini, then you just need open up the System Preferences and enable auto startup under the Energy Saver section. Once that has been enabled, you can then perform your ESXi installation.
If you already have ESXi installed, then you can use either Method 2 or 3.
Method 2 (Configure using bootable Ubuntu on USB)
We can create a bootable Ubuntu image running off of a USB device (minimal footprint) and run the following setpci command to enable auto startup:
setpci -s 0:1f.0 0xa4.b=0
If you are interested in the gory details on the above command, please refer to this great article
which breaks it all down for you. After you have created your Ubuntu
image using the instructions in the above link, you can boot off of the
USB device (Make sure to hold down ALT/OPT key so you can select to boot
off of the USB device). Once Ubuntu has booted up, you will right click
on the purple icon on the upper left hand corner and type in terminal.
You will then launch the terminal application and type the following to change over to root user.
sudo su -
Finally, you will enter the above setpci command which will enable the
auto startup. At this point, you can type reboot and remove the USB
device.
Method 3 (Configure using bootable OS X on USB)
Another method is to create a bootable OS X image running off of a USB device and change the power management settings by using the pmset utility. To enable auto startup, run the following command in the terminal:
pmset autorestart 1
You will need the original OS X installer and if you are using either Lion or Mountain Lion, you can use Lion DiskMaker
to help you create the bootable USB image (Make sure to hold down
ALT/OPT key so you can select to boot off of the USB device). Once the
OS X installer boots up, at the top select Utilities and click on the Terminal application.
Go ahead and run the above command to enable auto start and then type reboot and remove the USB device.
The last thing to do of course is to actually test this out on your Mac
Mini. Go ahead and let the system boot up and then yank the power cord
and then give it a few seconds before plugging it back in. You should
see the Mac Mini automatically power back on after you plug the power
back in.
No comments:
Post a Comment