17 December 2017

Friday was a snow day. Well, it *did* snow, and I was off work … but those were unrelated events. I did get some home office change work done. Last weekend, I hung up the skeletal F6F3 Hellcat in the corner of the room. I’m still occasionally flinching as I see it out of the corner of my eye as I walk past:

Skeletal F6F3 Hellcat model hanging from the ceiling in my home office.

Skeletal F6F3 Hellcat

On Friday, I spent twenty minutes and built a laptop stand for my MBP so that I could set it up dual screen with the HDMI monitor I use for several systems here:

My Macbook Pro on a home-built stand for dual monitor use

MBP on home-built stand

Saturday evening, we re-attended A Christmas Carol at ASC. As with previous shows, seeing opening night, then another run a couple of weeks later lets us watch the fine and talented actors settle into their roles and adapt to audience reactions. What fun!

*      *      *

DoD announced no new casualties in the last week, for which we are grateful.

13 December 2017

Friday the 13th falls on a Wednesday this month. And yes, yes, it isn’t Sunday. Sunday we were out at Annapolis Shakespeare‘s A Broadway Holiday in Annapolis. They gave us holiday and seasonal standards, marvelous singing by the company and friends, including the extraordinary and talented Rachelle Fleming. Simply wonderful. And a late Sunday night out rather gets my week off on the wrong foot – not much energy at all the last couple of evenings. But I’m back … just in time to spend tonight patching systems remotely. Yay?

Bob Thompson is continuing to battle health issues, and we’re pulling for him.

*      *      *

Our condolences to the family and friends of Staff Sgt. David Thomas Brabander, 24, of Anchorage, Alaska, who died on Dec. 11 in Nangarhar Province, Afghanistan, as a result of a non-combat related incident.

 

3 December 2017

Oh, hey, we put up the festive artificial tree last weekend:

Christmas tree is up - 2017

Christmas tree is up – 2017

Someone said that it had probably been up all year. When I pointed out that Marcia’s hip surgery and recovery therefrom precluded much decoration last year, the reply was that it must have been up for a couple of years then. I then noted two things. First, we picked up this fake tree half-price in the after-season sales in January of this year. Secondly, if I had to have the Christmas stuff up year ’round, I’d go find someone with Ebola to cough on me. Bah Humbug.

*      *      *

I also recently picked up the model plane project that I started a few years back, but put up in the closet while other tasks took center stage: It’s an F6F3 Hellcat.

F6F-3 Hellcat balsa model

F6F-3 Hellcat balsa model

I’ve been occasionally posting pictures of progress over the last few weeks on the twitters, but I’m close to done now. I’m going to paint it out and display it as is (no tissue skin on it) – I like the architectural feel of it as a skeleton of the plane. Also, I’ve had a cutting mat and a real mess all over my desk for the last few weeks. It’s quite nice to recover all that space.

*      *      *

Our condolences to the family and friends of Cpl. Todd L. McGurn, of Riverside, California, who died on Nov. 25, 2017, in Baghdad, Iraq as a result of a non-combat related incident.

 

 

26 November 2017

For those in the US, I hope y’all had a lovely Thanksgiving. We enjoyed a wonderful evening and repast with friends and (their) family. Then it was back to work for me on Friday. Then, yesterday evening, we attended the glorious opening night premiere production of A Christmas Carol at the Annapolis Shakespeare Company! Highly recommended.

*      *      *

On the side, I’m spending some time working with/learning more about Django. And I’m still working on that balsa model. The tail surfaces are affixed, and shaping of the wing continues.

*      *      *

DoD announced no new casualties in the most recent week, for which we are thankful. Ciao!

 

19 November 2017

Whelp. I see from Barbara’s postings that Bob is being cranky in the ICU, which is a pretty reasonable response, IMO. Pulling for a speedy recovery for him!

*      *      *

A busy work week, full of tasks, a holiday pot luck luncheon, and a lot of after-hours patching. All-in-all, productive and successful. I’ve also been working on the balsa model  of the F6F-3 Hellcat fighter, you can find pictures of that over on my twitter feed (@bilborg).

On the entertainment front, coming up soon from the Annapolis Shakespeare Company, we have the premiere of a new production of A Christmas Carol, from a story written by some bloke named Dickens. Yep, we’re looking forward to seeing that show, plus more from their continuing cabaret series!

*      *      *

I’d like to report that this Paperclip AI game is indeed addictive, precisely as reported in The Verge. If true, the universe is indeed paperclips, all the way down. And it’ll be our fault.

*      *      *

Our condolences to the family and friends of Sgt. 1st Class Hughton O. Brown, 43, of Brooklyn, New York, who died on Nov. 14 in Camp Buehring, Kuwait, as a result of a non-combat related incident.

 

13 November 2017

We’re pulling for Bob Thompson (site), who is having a particularly rough stretch with heart issues. We count on the doctors to find a way to safely treat what’s ailing him.

*       *       *

Our thanks to each and every veteran who fought to uphold our constitution.

*       *       *

A busy three day weekend is behind us. I got some holiday shopping done, and did some chores around the house, as well as remote work for $FIRM.

We got to spend another lovely Broadway show tunes cabaret evening Sunday night with our friends from Annapolis Shakespeare. We were treated to Marc Irwin, the new Musical Director, on piano backing up Sally, Ian, Olivia, and the guest opera singer: Madeline Miskie. Coming up, they’ve got the premiere of a newly written show from the Dickens novel: A Christmas Carol. We are so looking forward to that!

We’re also trying to plan some sort of travel in celebration of our twentieth anniversary, which is next year. We’ll probably manage a couple of shorter trips throughout the year, instead of one big long one. Meantime, take care of each other out there. It’s a dangerous world.

*       *       *

Our condolences to the family and friends of Chief Warrant Officer 2 Lee M. Smith, 35, of Arlington, Texas, who died on Nov. ‎11 at Camp Taji, Iraq, due to injuries sustained from a non-combat related incident.

Also, our condolences to the Buckley’s, the Weber’s, and the Bevis’s, all of whom have suffered the loss of a loved one in recent days.

6 November 2017

Yup, this should have been yesterday, but I was busy, then I was tired.  I had a good week last week. Productive at work, got most of the important chores done at home, and we went to a wedding on Friday. It was lovely. But there’s not much else to report, and I have more to do this evening. Enjoy yourselves.

*      *      *

Our condolences to the family and friends of Sgt. First Class Stephen B. Cribben, 33, of Simi Valley, California, who died on Nov. 4 in Logar Province, Afghanistan as a result of wounds sustained while engaged in combat operations.

 

29 October 2017

Boo! Ha Ha Ha!

There. That’s the extent of my seasonal participation in the upcoming Day of the Dead celebration.

*      *      *

This last week, we went to see POE… And All The Others, put on by the Annapolis Shakespeare Company. As with last year’s production, Poe was played with power and sensitivity by Brian Keith MacDonald. This year’s Muse (and all the others) was played by Olivia Ercolano. Olivia’s performance seemed to be informed, nay, infused, with the imperious strength of her Red Queen role from Alice, earlier this year. What a joy! There are still two chances to see this wonderful production – Monday and Wednesday of this week.

*      *      *

Work was work: Mostly devoted to monitoring systems this week. Some chores got done this weekend, but the rain came in today, and I had a lazy, lazy time of it.

*      *      *

Our condolences to the family and friends of Chief Warrant Officer Jacob M. Sims, 36, of Juneau, Alaska, who died Oct. 27 in Logar Province, Afghanistan, as a result of wounds sustained when he was involved in a helicopter crash.

22 October 2017

Work. Chores. A bit of Barrett-Jackson from Las Vegas. And there goes the week and the weekend. Seriously. The cars are clean, the lawn is mowed, the coffee is roasted, the roaster is clean, now, too, and most of the work has gone well. But with patching, there was a lot of that to go around.

There are only four more chances for you to see Much Ado About Nothing at the Annapolis Shakespeare Company, though, so get your ass over there and show them some love.

*      *      *

DoD reported no new casualties in the last week. Ciao!

15 October 2017

On the face of it, three day work weeks are pretty nice. But I stay busy, and cramming a week’s worth of productivity into three days is less fun than it sounds like. That said, I got done what needed doing, and the coming week is prepped and ready.

*      *      *

Last night, we went back for a second round of Annapolis Shakespeare‘s production of Much Ado About Nothing. With 17 actors and a two story set, there’s always more going on than one can take in at one sitting. Since opening night, the actors have really settled into their roles, and we enjoyed it even more, if that were possible. They’ve been getting stellar reviews all over the place and I can only say this: If you’re in the area, there are nine more productions of this show: today’s matinee and four shows each of the next two weekends. Get tickets and go!!!

*      *      *

The daylight hours yesterday were full, too. Much of the day, I puttered with virtualization on my main home server, a FreeBSD 11.1 box that does internal SMB, internal IMAP, backups, and virtual machine hosting. When I started with virtualization on the system, I was using Oracle’s VirtualBox product, because the price is right (free, as in beer), and easy, easy to setup and use. But easy isn’t always my primary goal. So I’ve been experimenting with the native virtualization tool on FreeBSD: bhyve.

“bhyve, the “BSD hypervisor”, pronounced “beehive” is a hypervisor/virtual machine manager developed on FreeBSD.”

I make use of the appropriate section of the FreeBSD Handbook to provide guidance. As such things go, it’s relatively simple to stand up FreeBSD virtual guests, and a bit trickier for Linux guests. I’ll document some of the fun I had with that here, because there are gotcha’s that aren’t covered in the Handbook.

The Setup

I’m going to build an Ubuntu 17.04 virtual machine (VM), using a ZFS volume as a datastore. The use of ZFS is recommended for performance reasons. There are other advantages, too, like the ability to make quick clones of a VM. More on that later. So, my configuration is this:

root@serenity:// > ls /data/bhyve
images iso
root@serenity:~/ > zfs list zroot/data/vmimages 
NAME USED AVAIL REFER MOUNTPOINT
zroot/data/vmimages 52.9G 1.07T 96K /data/vmimages

/data/bhyve/images is actually where I keep the runtime configuration and startup scripts for virtual machines.

/data/bhyve/iso is the repository for CD images for installation of virtual machines.

The ZFS path zroot/data/vmimages is the parent for all of my virtual machine disks.

I’ve also already done the initial networking setup with bridge and tap0 interfaces, per the Handbook sub-section, “Preparing the Host.”

Preparation

Create and check the VM disk:

root@serenity:/data/bhyve/images/ > zfs create -V16G -o volmode=dev zroot/data/vmimages/ub1704new
root@serenity:/data/bhyve/images/ > ls -al /dev/zvol/zroot/data/vmimages/ub1704new
crw-r----- 1 root operator 0x9b Oct 15 13:59 /dev/zvol/zroot/data/vmimages/ub1704new

With the disk volume in place, I can create the device map file, which sets (hd0) to the path to the new disk volume I created, and (cd0) to the  path to the ISO file (vim is the text editor I use):

root@serenity:/data/bhyve/images/ > vim ub1704new-device.map
root@serenity:/data/bhyve/images/ > cat ub1704new-device.map
(hd0) /dev/zvol/zroot/data/vmimages/ub1704new
(cd0) /data/bhyve/iso/ubuntu-17.04-server-amd64.iso

Note that when a VM is or has been running, it creates an entry in the device tree, at /dev/vmm. Normally, one must always “destroy” that file before one can start/restart the VM (seems clunky, but there it is). But because this is the first time this VM will have been run (on creation), there should be no corresponding device file at /dev/vmm/ub1704new. I’ll check that, then create the VM using the grub-bhyve tool, which prepares the boot environment for the VM:

root@serenity:/data/bhyve/images/ > ls /dev/vmm/ub1704new
ls: /dev/vmm/ub1704new: No such file or directory

root@serenity:/data/bhyve/images/ > grub-bhyve -m ub1704new-device.map -r cd0 -M 1024M ub1704new
 ...
GNU GRUB version 2.00

+--------------------------------------------------------------------------+
|Install Ubuntu Server                                                     |
|OEM install (for manufacturers)                                           |
|Install MAAS Region Controller                                            |
|Install MAAS Rack Controller                                              |
|Check disc for defects                                                    |
|Rescue a broken system                                                    |
|                                                                          |
|                                                                          |
+--------------------------------------------------------------------------+

Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, `e' to edit the commands
before booting or `c' for a command-line.

root@serenity:/data/bhyve/images/ > ls /dev/vmm/ub1704new
/dev/vmm/ub1704new

The “Install Ubuntu Server” line was highlighted, so I simple pressed the Enter key to accept that option. Disconcertingly, one is then dropped right back onto the command line. This is expected, however. And as you can see, we now have a VM entry for the new guest under /dev/vmm.

The next gotcha is this: There has to be a free tapN interface for the VM to attach to. The documentation wasn’t really clear on that, I think I assumed that multiple VMs could attach to a single tap interface. But in reality, think of the bridge interface as the virtual switch, and each tap interface as a port on that switch. So, let’s check if tap0 is in use:

root@serenity:/data/bhyve/images/ > ifconfig | egrep "^tap[0-9]+:"
tap0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
tap2: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500

As you can see, I’ve run into this problem already, and have a couple of spare taps available. This output shows that of the three tap interfaces, tap0 and tap2 are available, while tap1 is in use (see the word UP in the flags). For the purposes of this exercise I’ll just use tap0. But it’s trivial to add more tap devices on the fly, and to add them to the /etc/rc.conf file so that they are present for future runs. In a super-happy world, my VM automation script will look for any available tap device, and use one if found, otherwise dynamically add yet another one and use it. But that’s another post.

Install Time

So, it’s time to start the VM for the first time. Important note: One should set the amount of memory for the bhyve run to match the amount one set with grub-bhyve, or errors ensue. Observe that the memory setting with grub-bhyve above uses the -M flag, and a trailing M. The bhyve command uses a -m flag, and Megabytes are assumed.

I’m going to give the VM two processors (it can certainly take advantage of two, even during the installation)

root@serenity:/data/bhyve/images/ > bhyve -c 2 -m 1024 -H -P -A -s 0:0,hostbridge -s 1:0,lpc  \
 -s 2:0,virtio-net,tap0 -l com1,stdio -s 3,ahci-cd,/data/bhyve/iso/ubuntu-17.04-server-amd64.iso \
 -s 4,virtio-blk,/dev/zvol/zroot/data/vmimages/ub1704new ub1704new
 ...

  ┌───────────────────────┤ [!!] Select a language ├────────────────────────┐
  │                                                                         │
  │ Choose the language to be used for the installation process. The        │
  │ selected language will also be the default language for the installed   │
  │ system.                                                                 │
  │                                                                         │
  │ Language:                                                               │
  │                                                                         │
  │                               C                                         │
  │                               English                                   │
  │                                                                         │
  │  <Go Back>                                                              │
  │                                                                         │
  └─────────────────────────────────────────────────────────────────────────┘

 <Tab> moves;  <Space> selects;  <Enter> activates buttons

And so starts the text-mode Ubuntu installer. I’m going to assume you can find your way to figuring that out or find useful directions on the interwebs. A couple of installation tips:

  • The installer configures networking using DHCP by default. It’s easy to change to a static IP later, if desired.
  • Hostname entry – I generally use the name of the virtual machine I created. It’s just easier to keep straight in my head that way.
  • Partitioning – I’ve gone with “Guided – use entire disk and set up LVM”, but there are repercussions down the line. Manual isn’t hard, but can be confusing if you’ve not done much manual partitioning. LVM is a good choice because you can later add more diskspace to the volume(s) without even rebooting the system.
  • Automatic updates – These can be a good idea, some of the time. But with servers, I tend to have process around patching, booting, and testing, so I selected No Automatic Updates.
  • Software Selection – The only important choice for me at system installation is OpenSSH server: I need this to remotely administer any system: local or remote, physical or virtual.

Once the installer is done, there’s at least one more trick up my sleeve…

But first, we have to “destroy” the remnants of the prior run, then re-run grub-bhyve to figure out what our root and boot devices are:

root@serenity:/data/bhyve/images/ > bhyvectl --destroy --vm=ub1704new
root@serenity:/data/bhyve/images/ > grub-bhyve -m ub1704new-device.map -r hd0 -M 1024M ub1704new
 ...
grub> ls
(hd0) (hd0,msdos1) (cd0) (cd0,apple2) (cd0,apple1) (cd0,msdos2) (host) 
(lvm/ub1704new--vg-swap_1) (lvm/ub1704new--vg-root)
grub> ls (hd0)/
error: unknown filesystem.
grub> ls (hd0,msdos1)/
error: unknown filesystem.
grub> ls (lvm/ub1704new--vg-root)/
lost+found/ etc/ media/ bin/ boot/ dev/ home/ lib/ lib64/ mnt/ opt/ proc/ root/ run/ 
sbin/ srv/ sys/ tmp/ usr/ var/ initrd.img vmlinuz snap/
grub> cat (lvm/ub1704new--vg-root)/etc/fstab
 ...
/dev/mapper/ub1704new--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/ub1704new--vg-swap_1 none swap sw 0 0

And there’s the information we need to configure a file to prime grub automatically, but first, let’s get this system running for the first time after installation:

grub> linux (lvm/ub1704new--vg-root)/vmlinuz root=/dev/mapper/ub1704new--vg-root
grub> initrd (lvm/ub1704new--vg-root)/initrd.img
grub> boot
root@serenity:/data/bhyve/images/ >

There’s our prep done, now to run the machine:

root@serenity:/data/bhyve/images/ > bhyve -c 2 -m 1024 -H -P -A -s 0:0,hostbridge -s 1:0,lpc \ 
> -s 2:0,virtio-net,tap0 -l com1,stdio -s 4,virtio-blk,/dev/zvol/zroot/data/vmimages/ub1704new ub1704new
 ...
Ubuntu 17.04 ub1704new ttyS0

ub1704new login:bilbrey
Password: 
Welcome to Ubuntu 17.04 (GNU/Linux 4.10.0-19-generic x86_64)
 ...
bilbrey@ub1704new:~$

The next step is to update the freshly built system to with current packages and security updates, because the CD and DVD images are not respun every time there’s a changed package:

bilbrey@ub1704new:~$ sudo su -
[sudo] password for bilbrey: 
root@ub1704new:~# apt update && apt upgrade -y
 ...
root@ub1704new:~# sync
sroot@ub1704new:~# sync
root@ub1704new:~# shutdown -h now

With that done, now I’ll create a couple of files to make the startup much easier – we’ll create a file to feed grub-bhyve what it needs, and a quick and dirty shell script to automate all the startup options and run the VM:

root@serenity:/data/bhyve/images/ > vim ub1704new-grub.in  # pull together our grub info from the first startup...
root@serenity:/data/bhyve/images/ > cat ub1704new-grub.in
set root=(lvm/ub1704new--vg-root)
linux /vmlinuz root=/dev/mapper/ub1704new--vg-root
initrd /initrd.img
boot

root@serenity:/data/bhyve/images/ > vim start_ub1704new.sh  # shell script to config and run 
root@serenity:/data/bhyve/images/ > cat start_ub1704new.sh
#!/usr/local/bin/bash

#defaults
imgname="ub1704new"
imgpath="/dev/zvol/zroot/data/vmimages/${imgname}"
cpus=2
mem=2048
tap="tap0"

stkargs="-H -P -A -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,${tap} -l com1,stdio" 

cd /data/bhyve/images
bhyvectl --destroy --vm=${imgname}  # Clean up prior run
grub-bhyve -r hd0 -m ${imgname}-device.map -M ${mem}M ${imgname} < ${imgname}-grub.in  # prep grub boot 
bhyve -c ${cpus} -m ${mem} ${stkargs} -s 4,virtio-blk,${imgpath} ${imgname}  # Run the VM

root@serenity:/data/bhyve/images/ > chmod 700 start_ub1704new.sh  # Make the script runnable (by root)

All done, now I can just start the VM:

root@serenity:/data/bhyve/images/ > ./start_ub1704new.sh
 ...
Ubuntu 17.04 ub1704new ttyS0

ub1704new login: bilbrey
Password: 
 ...
bilbrey@ub1704new:~$ sudo su -
[sudo] password for bilbrey: 
root@ub1704new:~# sync
root@ub1704new:~# sync
root@ub1704new:~# shutdown -h now

Making Copies and Clones

Okay, a simple script run to start up the VM. That’s good. But we’ve put in a fair bit of work on this VM, what if I want some more of exactly that? I can use ZFS utilities to clone the VM image, do a couple of edits in copies of the files we just created, and we can have one or more copies without all the installation effort and pain. Here goes:

root@serenity:/data/bhyve/images/ > zfs list -rt all zroot/data/vmimages/ub1704new
NAME USED AVAIL REFER MOUNTPOINT
zroot/data/vmimages/ub1704new 16.5G 1.07T 3.32G -

root@serenity:/data/bhyve/images/ > zfs snapshot zroot/data/vmimages/ub1704new@copy1

root@serenity:/data/bhyve/images/ > zfs clone zroot/data/vmimages/ub1704new@copy1 zroot/data/vmimages/ub1704copy1

root@serenity:/data/bhyve/images/ > zfs list -rt all zroot/data/vmimages
NAME USED AVAIL REFER MOUNTPOINT
zroot/data/vmimages 72.9G 1.05T 96K /data/vmimages
 ...
zroot/data/vmimages/ub1704copy1 8K 1.05T 3.32G -
zroot/data/vmimages/ub1704new 19.8G 1.07T 3.32G -
zroot/data/vmimages/ub1704new@copy1 0 - 3.32G -

root@serenity:/data/bhyve/images/ > zfs get origin zroot/data/vmimages/ub1704copy1
NAME                             PROPERTY  VALUE                                SOURCE
zroot/data/vmimages/ub1704copy1  origin    zroot/data/vmimages/ub1704new@copy1  -

[* Editors note – Updated above to add the zfs snapshot command, which did not survive the original cut and paste]

This read/write clone, ub1704copy1, takes about as long as it takes to run the snapshot and clone commands – no time at all, really. But it will be dependent on the snapshot (see the output of the zfs get origin command), and not an independent copy of the VM. So for quick-and-dirty testing, this is a great tool. If, on the other hand, you want to make use of that snapshot to make a long-lived copy of the VM, use the ZFS send/receive functionality:

root@serenity:/data/bhyve/images/ > zfs send zroot/data/vmimages/ub1704new@copy1 \
 | zfs receive zroot/data/vmimages/ub1704copy2

root@serenity:/data/bhyve/images/ > zfs list -rt all zroot/data/vmimages
NAME                                         USED  AVAIL  REFER  MOUNTPOINT
zroot/data/vmimages                         76.2G  1.05T    96K  /data/vmimages
zroot/data/vmimages/ub1704copy1                8K  1.05T  3.32G  -
zroot/data/vmimages/ub1704copy2             3.32G  1.05T  3.32G  -
zroot/data/vmimages/ub1704copy2@copy1           0      -  3.32G  -
zroot/data/vmimages/ub1704new               19.8G  1.06T  3.32G  -
zroot/data/vmimages/ub1704new@copy1             0      -  3.32G  -

root@serenity:/data/bhyve/images/ > zfs get origin zroot/data/vmimages/ub1704copy2
NAME                             PROPERTY  VALUE   SOURCE
zroot/data/vmimages/ub1704copy2  origin    -       -

root@serenity:/data/bhyve/images/ > zfs destroy zroot/data/vmimages/ub1704copy2@copy1

Note that the send/receive ALSO copied the snapshot, so I disposed of the copied snapshot… The send/receive took a couple of minutes for this small VM. A much larger VM would take a correspondingly longer time. Let’s create the scripts to run ub1704copy2:

root@serenity:/data/bhyve/images/ > cp ub1704new-grub.in ub1704copy2-grub.in
root@serenity:/data/bhyve/images/ > cp ub1704new-device.map ub1704copy2-device.map
root@serenity:/data/bhyve/images/ > cp start_ub1704new.sh start_ub1704copy2.sh

root@serenity:/data/bhyve/images/ > vim *ub1704copy2*
 ...

root@serenity:/data/bhyve/images/ > diff start_ub1704new.sh start_ub1704copy2.sh
5c5
< imgname="ub1704new" 
--- 
> imgname="ub1704copy2"
8,9c8,9
< mem=2048
< tap="tap0" 
--- 
> mem=4096
> tap="tap2"

root@serenity:/data/bhyve/images/ > diff ub1704new-device.map ub1704copy2-device.map
1c1
< (hd0) /dev/zvol/zroot/data/vmimages/ub1704new 
--- 
> (hd0) /dev/zvol/zroot/data/vmimages/ub1704copy2

root@serenity:/data/bhyve/images/ > diff ub1704new-grub.in ub1704copy2-grub.in

So, no changes to the grub.in file, as all things are the same, including the name of the LVM filesystem that is root. Remember, even though the VM is now ub1704copy2, it’s a copy of ub1704new, and will be until we run it, change the hostname, and make it different.

The device.map file has to change to point to the new ZFS volume, but that’s all.

And for the start_ub1704copy2.sh file, I really only had to change the imgname variable to make everything work.  But I also bumped the memory up to 4G, and changed the network device to tap2, so that new and copy2 could be running simultaneously. Now let’s boot copy2, change the hostname, and boot it again:

root@serenity:/data/bhyve/images/ > ./start_ub1704copy2.sh
  ...
ub1704new login: bilbrey
Password: 
  ...
bilbrey@ub1704new:~$ sudo su -
[sudo] password for bilbrey:
root@ub1704new:~# vim /etc/hostname
root@ub1704new:~# cat /etc/hostname
ub1704copy1

root@ub1704new:~# sync
root@ub1704new:~# sync
root@ub1704new:~# shutdown -h now

root@serenity:/data/bhyve/images/ > ./start_ub1704copy2.sh
  ...
Ubuntu 17.04 ub1704copy1 ttyS0

ub1704copy1 login: bilbrey
Password: 
  ...
bilbrey@ub1704copy1:~$ ip addr show dev enp0s2
2: enp0s2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:a0:98:27:32:75 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.108/24 brd 192.168.1.255 scope global enp0s2
       valid_lft forever preferred_lft forever
    inet6 fe80::2a0:98ff:fe27:3275/64 scope link 
       valid_lft forever preferred_lft forever

Okay, we’re running in copy2, renamed the host, and we have an IP address. Let’s start up ub1704new, and ping the copy:

root@serenity:/data/bhyve/images/ > ./start_ub1704new.sh
  ...
Ubuntu 17.04 ub1704new ttyS0

ub1704new login: bilbrey
Password: 
  ...
bilbrey@ub1704new:~$ ip addr show dev enp0s2
2: enp0s2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:a0:98:d4:48:eb brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.136/24 brd 192.168.1.255 scope global enp0s2
       valid_lft forever preferred_lft forever
    inet6 fe80::2a0:98ff:fed4:48eb/64 scope link 
       valid_lft forever preferred_lft forever

bilbrey@ub1704new:~$ ping 192.168.1.108
PING 192.168.1.108 (192.168.1.108) 56(84) bytes of data.
64 bytes from 192.168.1.108: icmp_seq=1 ttl=64 time=0.889 ms
64 bytes from 192.168.1.108: icmp_seq=2 ttl=64 time=0.652 ms
 ...
bilbrey@ub1704new:~$ ssh 192.168.1.108
The authenticity of host '192.168.1.108 (192.168.1.108)' can't be established.
ECDSA key fingerprint is SHA256:yARJTbiR8K2S1pTrYZ8xdDZawGMVqtukB3th2cf1Zjw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.108' (ECDSA) to the list of known hosts.
bilbrey@192.168.1.108's password: 
  ...
Last login: Sun Oct 15 20:26:57 2017
bilbrey@ub1704copy1:~$

There we go. The clones and copies are super fast and easy. I’m told by the interwebs that there are tools called vm-bhyve and iohyve that might be useful, but those are for another day.

*      *      *

DoD announced no new casualties in the last week. Ciao!