This write-up aims to show you how to set up SmartOS with a mirrored disk pool and your first virtualised application in Node.js.
SmartOS has an impressive UNIX heritage going as far back as 1982 where its forefather SunOS was developed by Sun Microsystems. Since then some game-changer like Zones, DTrace, built-in KVM virtualization and ZFS have been added.
All of the above were combined by Joyent's Illumnos project to create a first-class, open-source hypervisor. Joyent deploy their operating system in the Triton which is similar to the Amazon's EC2 cloud.
SmartOS is designed to boot from a USB pen-drive so that all the disks in your machine are available for zones and VMs. You can also install SmartOS into a VM with Virtualbox but you may only be able to use Zones rather than all the KVM features due to nested virtualisation.
Booting from a USB pen-drive means you can easily upgrade the entire operating system.
On first boot you will need to provide:
- an IP address or select by DHCP
- a nameserver such as 18.104.22.168
- the search domain
- how to partition your disks
- such as stripped, mirrored or RAID-Z
- a root password
The machine will then reboot and you will see the login prompt. I don't think I've ever seen a server OS install so quickly, it's probably a tie for bringing up a new cloud image.
The first thing to do after logging in is to check out the ZFS pools created at install time. You should have a pool named
By default there is no
sudo command installed, but this is available from
pkgin SmartOS's package manager.
# zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT zones 148G 4.04G 144G - 0% 2% 1.00x ONLINE -
Here's how you check the status of the pool:
zpool status pool: zones state: ONLINE scan: resilvered 4.04G in 0h1m with 0 errors on Wed Dec 14 23:10:56 2016 config: NAME STATE READ WRITE CKSUM zones ONLINE 0 0 0 c2d0 ONLINE 0 0 0 errors: No known data errors
You can list your volumes with
zfs list - this will include an area for the USB pen-drive's persistent configuration and any zones you set up will appear here too.
zpool iostat command will show you what kind of bandwidth your drives are capable of.
# zpool iostat capacity operations bandwidth pool alloc free read write read write ---------- ----- ----- ----- ----- ----- ----- zones 4.04G 144G 0 30 236 2.04M
That's as far as I got
Unfortunately I never had the time to fully write-up the rest of this tutorial, but I would think it may be a useful starting point for someone else. I wanted to release this for the community and I hope to see some of the usual spin-off blog posts.
If you'd like to see more, please reach out to me on Twitter @alexellisuk.