ESXi | Home Assistant as VM (old VMDK)
Setup guide for Home Assistant as ESXi 7 Virtual Machine. (VMDK image file)
How to properly setup Home Assistant as a VMware ESXi 7 Virtual Machine, so that you can run snapshots and do live backups with e.g. Veeam Backup & Replication.
The old VMDK file (hassos_ova-x.xx.vmdk) is a Workstation/Player type of file and needs to be converted using ESXi vmkfstools so that you can use para-virtualized SCSI controller as well as VMNET3. This conversion will allow live snapshots and quiesce mode for hot backup.
Why run HA as a VM
If you just run HA without bigger modifications or constantly testing and changing it, then probably no reason to run it as a VM. But if you are like me that you constantly test, make changes, and try out new integrations, then you might find yourself restoring or reinstalling HA from time to time, for me somehow it used to be the latter, constant reinstalls.
Veeam Backup & Replication
I have been really pleasantly surprised by how well the Veeam Backup & Replication (Community Edition) works. The only bad thing for me was that you can only install it on a Windows machine, but once you get past that, it's been a smooth ride.
One of the major benefits of running Home Assistant as a virtual machine is that you can really easily take snapshots, and also easily restore them when needed. I usually take snapshots right before major changes or updates.
Full and incremental backups (Veeam)
Another benefit is that you can do full or incremental backups, with tools like Veeam Backup & Replication.
Item level restoration (Veeam)
The major benefit that Veeam gives me is the item-level restoration. That has saved me a couple of times from a bigger restoration process. If you have done incremental backups you can even go back to different versions of the individual files.
Step-by-step instructions on how to set up Home Assistant OS into VMware ESXi 7 as a virtual machine.
VMDK Image File
Upload the hassos_ova-x.xx.vmdk image to your Images folder in the datastore with Datastore Browser (x.xx is the version number).
In ESXi I have created a separate folder for my image files (your path may be different).
The old VMDK file (hassos_ova-x.xx.vmdk) is a Workstation/Player type of file and needs to be converted so that e.g. live snapshots and backups are possible.
With the old VMDK image file you had to convert the file in ESXi, so that you can do live snapshots and backups.
Enable SSH on ESXi
SSH into ESXi and run these commands targeting the VMDK image file
# CD to the image folder cd vmfs/volumes/datastore1/ISOs # Option 1 -> Create Thick Provisioned clone (recommended) vmkfstools -i hassos_ova-x.xx.vmdk hassos-esxi-x.xx.vmdk # Option 2 -> Create Thin Provisioned clone vmkfstools -i hassos_ova-x.xx.vmdk hassos-esxi-x.xx.vmdk -d thin # vmkfstools -i hassos_ova-4.15.vmdk hassos-esxi-4.15.vmdk -d thin # https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-16D15895-5D91-437A-9304-EBBF4458934B.html -i --clonevirtualdisk srcDisk -d --diskformat [zeroedthick |thin |eagerzeroedthick |rdm:<device>|rdmp:<device> |2gbsparse]
Edit the “small” vmdk and change adapterType from "ide" to "lsilogic".
Close the SSH connection, and you can disable SSH in ESXi
Optionally you can also remove the original VMDK file from the datastore.
With the Datastore Browser create a new directory for Home Assistant VM, and copy the converted vmdk file into that folder.
Create a new VM
Set VM name and guest OS
Customize the Settings
|Hard Disk 1||Remove By Pressing X|
Delete the predefined Hard Disk add an Existing Hard Disk and point it to the image file in your Home Assistant VM directory.
Change the New Hard Disk Controller Location to IDE controller 0, you can change the size later after the first save (also thin provisioned will be reported correctly after save)
Edit the VM Options. Ensure that Firmware is set to EFI, if it does not boot correctly, enable Force Bios Setup for the next boot and change the boot order.
Save the settings. Click edit to change the Hard Disk Size. (You should now see the thin provisioned correctly)