Skip to content

Commands

Mark Gilbert edited this page Jul 10, 2022 · 1 revision

Packaging a box from an existing box

For LX Zones you can use a Joyent UUID, for Bhyve Zones, you can use a ZSS file or a image from the Vagrant Cloud with the Zone provider. There may be future work to convert existing images to a Zone provider type.

Once you have setup your a box with an existing box, you can create a box from that with:

vagrant package --output test4.box

Convert a box

This will allow you to attempt to use a Vagrant Virtualbox provider box and have it converted to Bhyve/KVM.

Run the box

Then execute this command to start the box with bhyve ( '--provider=zone' may be necessary if not defined in Vagrant file)

$ pfexec vagrant up 

SSH into the box

After the box is started, you can ssh into by executing this command.

$ /path/to/vagrant-zones/bin/vagrant ssh

Shutdown the box and cleanup

This command will shutdown the booted VM and clean up environment

$ /path/to/vagrant-zones/bin/vagrant halt

Destroy the box

$ /path/to/vagrant-zones/vagrant destroy

Cleanly restart the guest vm.

This command will shutdown the booted VM and clean up environment

$ /path/to/vagrant-zones/bin/vagrant zone control restart

Cleanly shutdown the guest vm.

$ /path/to/vagrant-zones/vagrant zone control shutdown

Manage a Console Session

$ /path/to/vagrant-zones/vagrant zone console webvnc/vnc/zlogin --host 0.0.0.0 -port 5900 --detach <yes/no> --kill <yes/no>

Take a Snapshot

$ /path/to/vagrant-zones/vagrant zone zfssnapshot create (--dataset pathtodataset or index id or all) (--snapshot_name name of snapshot or all)

Delete a Snapshot

$ /path/to/vagrant-zones/vagrant zone zfssnapshot delete (--dataset pathtodataset or index id or all) (--snapshot_name name of snapshot or all)

List Snapshots

$ /path/to/vagrant-zones/vagrant zone zfssnapshot list (--dataset pathtodataset or index id or all) (--snapshot_name name of snapshot or all)

Configure Snapshot cron (only applies is you provide a script to manage the snapshots)

$ /path/to/vagrant-zones/vagrant zone zfssnapshot configure (--dataset pathtodataset or index id or all) (--set_frequency hour/daily/weekly/monthly/all) (--set_frequency_rtn custom number for set_frequency)

Remove a Snapshot cron (only applies is you provide a script to manage the snapshots)

$ /path/to/vagrant-zones/vagrant zone zfssnapshot configure (--dataset pathtodataset or index id or all) (--delete hour/daily/weekly/monthly/all) 

List Snapshot cron (only applies is you provide a script to manage the snapshots)

$ /path/to/vagrant-zones/vagrant zone zfssnapshot configure (--list pathtodataset or index id or all) (--set_frequency hour/daily/weekly/monthly/all)