Skip to content

Instantly share code, notes, and snippets.

@jperkin
Last active September 11, 2018 15:09
Show Gist options
  • Select an option

  • Save jperkin/5243605 to your computer and use it in GitHub Desktop.

Select an option

Save jperkin/5243605 to your computer and use it in GitHub Desktop.

Revisions

  1. jperkin revised this gist Mar 26, 2013. 2 changed files with 7 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -9,13 +9,16 @@ Install
    cp NetBSD-6.0-amd64.iso /zones/$zoneuuid/root/netbsd.iso
    vmadm boot $zoneuuid order=cd,once=d cdrom=/netbsd.iso,ide
    vmadm info $zoneuuid vnc
    open -a chicken vnc://vnc.host:vnc.port

    You can now VNC to vnc.host:vnc.port as per the output of the `vmadm info` command, and perform the OS install.

    Once the install is done, 'poweroff' in the VM.

    Create image
    ============

    Take a snapshot of the installed image, update the image manifest with the image size and SHA1, then install it.

    zfs snapshot zones/$zoneuuid-disk0@snap
    zfs send !$ | gzip >netbsd6-0.0.1.zvol.gz
    ls -l !$
    @@ -26,4 +29,6 @@ Create image
    Create new VMs
    ==============

    Finally, now that the image is installed, we can create as many NetBSD images from it as we want.

    vmadm create < netbsd.json
    1 change: 1 addition & 0 deletions netbsd6.json
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    {
    "brand": "kvm",
    "autoboot": true,
    "ram": 512,
  2. jperkin revised this gist Mar 26, 2013. 2 changed files with 1 addition and 4 deletions.
    4 changes: 1 addition & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,4 @@ Create image
    Create new VMs
    ==============

    vi netbsd.json # change image_uuid

    vmadm create < netbsd.json
    vmadm create < netbsd.json
    1 change: 0 additions & 1 deletion netbsd6.json
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    "brand": "kvm",
    "autoboot": true,
    "ram": 512,
  3. jperkin created this gist Mar 26, 2013.
    31 changes: 31 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    Instructions for building a NetBSD VM

    Install
    =======

    vmadm create < netbsd-install.json
    vmadm list
    zoneuuid=...
    cp NetBSD-6.0-amd64.iso /zones/$zoneuuid/root/netbsd.iso
    vmadm boot $zoneuuid order=cd,once=d cdrom=/netbsd.iso,ide
    vmadm info $zoneuuid vnc
    open -a chicken vnc://vnc.host:vnc.port

    Once the install is done, 'poweroff' in the VM.

    Create image
    ============

    zfs snapshot zones/$zoneuuid-disk0@snap
    zfs send !$ | gzip >netbsd6-0.0.1.zvol.gz
    ls -l !$
    digest -a sha1 !$
    vi netbsd6-0.0.1.json # add size and sha1
    imgadm install -m netbsd6-0.0.1.json -f netbsd6-0.0.1.zvol.gz

    Create new VMs
    ==============

    vi netbsd.json # change image_uuid

    vmadm create < netbsd.json
    19 changes: 19 additions & 0 deletions netbsd-install.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    {
    "brand": "kvm",
    "autoboot": false,
    "ram": 512,
    "disks": [
    {
    "boot": true,
    "model": "virtio",
    "size": 2048
    }
    ],
    "nics": [
    {
    "nic_tag": "admin",
    "model": "virtio",
    "ip": "dhcp"
    }
    ]
    }
    36 changes: 36 additions & 0 deletions netbsd6-0.0.1.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    {
    "v": 2,
    "uuid": "93bfa14a-931c-11e2-88ec-abddd29e435d",
    "owner": "0ca387a2-92d2-11e2-b623-6b615ec71835",
    "name": "netbsd-6.0-amd64",
    "version": "0.0.1",
    "state": "active",
    "disabled": false,
    "public": true,
    "published_at": "2013-03-23T00:00:00Z",
    "type": "zvol",
    "os": "netbsd",
    "files": [
    {
    "sha1": "f577ab706ffd4567fae09858a1da3ddcce272542",
    "size": 59148086,
    "compression": "gzip"
    }
    ],
    "description": "NetBSD/amd64 6.0 Minimal Install",
    "urn": "smartos:jperkin:netbsd-6.0-amd64:0.0.1",
    "requirements": {
    "networks": [
    {
    "name": "net0",
    "description": "public"
    }
    ],
    "ssh_key": true
    },
    "acl": [],
    "nic_driver": "virtio",
    "disk_driver": "virtio",
    "cpu_type": "qemu64",
    "image_size": 2048
    }
    21 changes: 21 additions & 0 deletions netbsd6.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@

    "brand": "kvm",
    "autoboot": true,
    "ram": 512,
    "alias": "netbsd6",
    "disks": [
    {
    "boot": true,
    "model": "virtio",
    "image_uuid": "93bfa14a-931c-11e2-88ec-abddd29e435d",
    "image_size": 2048
    }
    ],
    "nics": [
    {
    "nic_tag": "admin",
    "model": "virtio",
    "ip": "dhcp"
    }
    ]
    }