Moving a Solaris 10 Zone

Today I wanted to move a Solaris 9 zone running on a Solaris 10 test server to a new ZFS dataset within the same ZFS pool with compression enabled. This container is an archive of an environment we don’t use very much, normally leave shut down, and intend to delete fairly soon, but since it’s a flash archive of a Solaris 9 machine, it takes up a lot of space on the test system’s local disks.

First I created the new dataset:

# zfs create rpool/zones
# zfs set mountpoint=/zones rpool/zones
# zfs create rpool/zones/foo
# zfs set compression=on rpool/zones/foo

I thought I should halt the zone, update the zonepath property for the zone, move the files to the new place, and start up the zone. Nope:

zonecfg:foo> set zonepath=/zones/foo
Zone foo already installed; set zonepath not allowed.

Great, now I’m going to have to search through a bunch of docs and maybe remove the zone and redo it all and why can’t they make this easy for me, argh.

Well, they did:

# zoneadm -z foo move /zones/foo

I like a lot of the changes in Solaris 10, especially the usage and man pages for things like zfs(1M). These commands tend to do the annoying things for you and the man pages have lots of examples. Nice.

And hey:

# zfs get compressratio rpool/zones/foo
NAME               PROPERTY       VALUE              SOURCE
rpool/zones/foo  compressratio  1.44x              -