If you for any reason want to make a live snapshot of a running zone in Solaris the best way would probably be to use snapshot facilities of the underlying filesystem. But if that is not an option for any reason it can be done with CPIO. While there are no guaranties for the state of the data that are sequentially copied, it might be of some use for example upgrade tests. I have used this to test upgrade of a few local zones just to see that the process works.
I've seen other methods of doing this on the net, but they did not work for me, they did not include directories such as /proc which are mounted with a pseudo filesystem when the zone is running. This method also excludes files of type socket, since cpio is unable to handle them, they should be recreated by their applications
# find <zoneroot> ! -fstype ufs -prune -o -fstype ufs ! -type s | cpio -ocm -O /var/tmp/<zone>.cpio
If you plan on using the unarchived image for upgrade tests, make sure the mnttab is empty, if its size is !0 live upgrade will fail.
I have used this on zones located on VxFS (god forbid, not my choice, nothing against VxFS but one should not put the zoneroot on anything other that UFS for now if upgrading is of interest).
Reflecting on The Soul of a New Machine
4 months ago