On 28/05/11 02:23 AM, Dave Koelmeyer wrote:
On 28/05/11 01:29 AM, Dave Koelmeyer wrote:
From: Dave Koelmeyer<davekoelme...@me.com>
Date: Wed, 25 May 2011 06:03:41
To: Discussion list for
OpenIndiana<openindiana-discuss@openindiana.org>
Reply-To: Discussion list for
OpenIndiana<openindiana-discuss@openindiana.org>
Subject: [OpenIndiana-discuss] Migrating zones between OpenIndiana
machines
Hi,
I'm having a hell of a time trying to simply migrate a zone from one
OI machine to another, wondering if anyone can help. Both machines
are running oi_147
I have configured and install a NGZ on machine 1, and wish to detach
and install it on machine 2.
I am following the guide here:
http://download.oracle.com/docs/cd/E19044-01/sol.containers/819-2450/gcgnc/index.html
On machine 1:
First I have run zoneadm -z myzone detach
Then, cd /rpool/zones/zone_roots and tar cvf myzone.tar myzone/
This creates a .tar file of the zone, which I've then copied over to
machine 2
On machine 2:
I've extracted the .tar file to /rpool/zones/zone_roots
The above steps so far are all covered at:
http://download.oracle.com/docs/cd/E19044-01/sol.containers/819-2450/gcglo/index.html
So, next I run:
zonecfg -z myzone
create -a /rpool/zones/zone_roots/myzone
I alter the zone configuration properties as needed for networking
etc, then commit and exit.
Finally, I attempt to attach the zone:
pfexec zoneadm -z myzone attach
at which point I get:
Log File: /var/tmp/myzone.attach_log.Wsaq8n
ERROR: no active dataset.
Result: Attach Failed.
What is this referring to, and why can I not find any reference to
it in the documentation? Any pointers welcome :)
Cheers,
Dave
On 25/05/11 06:16 PM, Okky Hendriansyah wrote:
Hi Dave,
What are the output of "zfs list" on both machines? I think you have
to create the "myzone" ZFS dataset on machine 2 before attaching the
zone to it.
Regards,
Okky Hendriansyah
Hi Okky,
Thanks for your reply, output of machine 1 (the source machine) and
machine 2 (the target):
Machine 1:
NAME USED AVAIL
REFER MOUNTPOINT
rpool/zones 7.80G 214G
34K /rpool/zones
rpool/zones/zone_roots 7.80G 214G
35K /rpool/zones/zone_roots
rpool/zones/zone_roots/myzone 4.08G 214G 33K
/rpool/zones/zone_roots/myzone
rpool/zones/zone_roots/myzone/ROOT 4.08G 214G 31K legacy
rpool/zones/zone_roots/myzone/ROOT/zbe 4.08G 214G 4.01G legacy
Machine 2:
NAME USED AVAIL
REFER MOUNTPOINT
rpool/zones 7.59G 18.8G
32K /rpool/zones
rpool/zones/zone_roots 7.59G 18.8G
7.59G /rpool/zones/zone_roots
So yes, the ""myzone" ZFS data set does not exist, but wouldn't this
get created when the zone is attached? Alternatively, creating the
dataset manually before the zone is attached does not change the
behaviour, and I get the same error message.
I'm clearly getting something confused here, any ideas?
As tends to happen, right after sending this I located a guide which
apparently doesn't make the assumptions in the first documentation
link I sent, specifically the section headed "Containers Residing on
an Oracle Solaris ZFS Filesystem":
http://developers.sun.com/solaris/docs/howto_movesolariscontainer_051410-1.pdf
Will work thought this and shout if I have questions...
Well, if this wasn't the biggest pain in the arse to actually get going
(the document linked above was useless) - a brief summary of what to do
(pieced together from a bunch of places on the web) follows in case
anyone else needs it in the future (will blog this too):
In summary, I want to migrate the zone "myzone" on machine 1 to machine 2.
On Machine 1:
1) Detach myzone, e.g.:
#zoneadm -z myzone detach
2) Make snapshots of the following ZFS filesystems relevant to the zone
"myzone":
rpool/zones/zone_roots/myzone
rpool/zones/zone_roots/myzone/ROOT
rpool/zones/zone_roots/myzone/ROOT/zbe
e.g.
# zfs snapshot -r rpool/zones/zone_roots/myzone@snap1
3) Archive the snapshots into files in preparation for copying to
machine 2, e.g.:
# zfs send rpool/zones/zone_roots/myzone@snap1 >
/export/home/davek/myzone.snap1
# zfs send rpool/zones/zone_roots/myzone/ROOT@snap1 >
/export/home/davek/myzone_root.snap1
# zfs send rpool/zones/zone_roots/myzone/ROOT/zbe@snap1 >
/export/home/davek/myzone_root_zbe.snap1
4) Copy the archived snapshot files to machine 2 in any way you see fit
On Machine 2:
1) Assuming the desired zonepath for your zones is
/rpool/zones/zone_roots, create the ZFS filesystems if necessary, e.g.:
# zfs create rpool/zones
# zfs create rpool/zones/zone_roots
2) Restore the snapshot files into the relevant ZFS filesystems (these
will be created on the fly), e.g.:
# zfs receive rpool/zones/zone_roots/myzone <
/export/home/davek/myzone.snap1
# zfs receive rpool/zones/zone_roots/myzone/ROOT <
/export/home/davek/myzone_root.snap1
# zfs receive rpool/zones/zone_roots/myzone/ROOT/zbe <
/export/home/davek/myzone_root_zbe.snap1
3) Change the mountpoint type to legacy for the following two ZFS
filesystems:
rpool/zones/zone_roots/myzone/ROOT
rpool/zones/zone_roots/myzone/ROOT/zbe
e.g.:
# zfs set mountpoint=legacy rpool/zones/zone_roots/myzone/ROOT
# zfs set mountpoint=legacy rpool/zones/zone_roots/myzone/ROOT/zbe
4) Mount the following filesystem using a legacy mount command:
rpool/zones/zone_roots/myzone/ROOT/zbe
We want to mount this to /rpool/zones/zone_roots/myzone/root
e.g.:
# mount -F zfs rpool/zones/zone_roots/myzone/ROOT/zbe
/rpool/zones/zone_roots/myzone/root
5) Now, configure the zone:
# zonecfg -z myzone
When prompted to create a zone, use the XML configuration file that will
be sitting in /rpool/zones/zone_roots/myzone. Use the create command in
the following way:
create -a /rpool/zones/zone_roots/myzone
If this is successful, you won't receive any confirmation (only an error
if the configuration file cannot be found).
Continue to use zonecfg to customise any properties relevant to machine
2 (e.g. set a different IP address), then commit the changes and exit
zonecfg
6) Attach the zone
Finally, run the follwing:
# zoneadm -z myzone attach -u
Zone will attach and can now be booted.
--
Dave Koelmeyer
http://davekoelmeyer.wordpress.com/
_______________________________________________
OpenIndiana-discuss mailing list
OpenIndiana-discuss@openindiana.org
http://openindiana.org/mailman/listinfo/openindiana-discuss