pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image# b996c578-c4fc-46ef-81cc-d2eb3489ebc6 is the UUID
# of the zone I want to snapshot and clone. `uuid`
# returns a new UUID.
zfs snapshot zones/b996c578-c4fc-46ef-81cc-d2eb3489ebc6@`uuid`
# we can see the snapshot we made
zfs list -t snapshot
# create a new UUID for the clone
export CLONE_UUID=`uuid`
# clone!
# the UUID after the `@` is the UUID for from our snapshot version
zfs send zones/b996c578-c4fc-46ef-81cc-d2eb3489ebc6@81e67092-cb63-11e1-b0f3-fbc4021003b3 | zfs recv zones/$CLONE_UUID
# now you should be able to use $CLONE_UUID as a "dataset_uuid" in a VM json spec.After stopping and running the prepare script on my machine, I was unable to log in via ssh again. I saw this ssh error:
Unable to negotiate a key exchange method
I fixed this by zlogin'ing back into the machine and running the following:
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
svcadm restart ssh
@pgte This should be because the new image was not imported with
imgadm. Look at/var/imgadm/images. Make a copy of a json file already there, rename it with your UUID and replace (at least) the UUID inside the file. Now it should work invmadm. Think you can also do it withimgadm importbut then you would need to export to a tarball before.I don't have any idea if this is the correct way. Its just how I have done it.
also, theres no need for send+receive if you use the same machine. Just use
zfs clone