"piadm" or how to boot SmartOS from the local hard disk
SmartOS is a hypervisor that traditionally boots from a USB device, a CD-ROM/DVD or PXE. That is nice and convenient because you can easily upgrade and even downgrade safely without touching the hard disk, test new versions with no consequences, and you always have a bootable system whatever you do.
But this convenience requires physical access to the hardware or plugging extra devices (USB) into remote hosted machine, usually something you have to pay for as an extra. I overcame those by playing dangerously, as I documented in:
- Installing/booting SmartOS in/from a harddisk without physical access.
- Upgrading SmartOS when installed in your harddisk.
- Notas de trabajo: Upgrading SmartOS when installed in your harddisk.
Nice hacks of mine.
Since a couple of years ago, SmartOS has been able to officially install itself and boot from the hard disk. Welcome to the new piadm command.
First, some reading you might find interesting and useful:
- Now you can boot SmartOS off of a ZFS pool.
- Standalone SmartOS Gets Selectable PIs.
- RFD 176 SmartOS and Triton boot from ZFS pool.
- Upgrading SmartOS.
- OS-8198: Allow bootable-off-ZFS-pool ("standalone") SmartOS.
- OS-8204: Add "avail" subcommand to piadm(1M).
- OS-8206: Enable piadm(1M) to detect and install on-disk iPXE on Triton CNs.
- OS-8209: piadm should support persistent loader.{rc,conf}.local.
- OS-8231: Bootable zpools need loader-selectable options.
- OS-8416: piadm(8) needs to unmount/not-unmount v1 USB key properly.
So, things you need to know:
-
If your SmartOS machine is able to boot from the hard disk using standard BIOS, you can just install SmartOS on your current zones ZFS pool.
-
If your SmartOS machine requires UEFI boot, you cannot install SmartOS on your current zones ZFS pool as is. You need a small FAT partition (EFI System Partition, ESP) for UEFI boot. That partition is created when formatting the ZFS pool with zpool create -B).
This is done automatically when creating a new zones ZFS pool and asking to boot from it. You can do it "by hand" on an already created ZPOOL, messing with the partition table, but this is risky and out of scope for this article.
Ideally, for new SmartOS deployments, you should create the ZPOOL with the EFI System Partition even if you plan not to use it, so you could boot the ZPOOL in the future if you change your mind. I think zpool create -B should be the default option, but this is not currently the case.