这似乎是一个简单的事情要做,如果它只会按照logging工作。 但是,由于zoneadm移动过程中的一些错误,它不起作用。 去搞清楚。 首先让我看看那些简单的文档所说的:
http://docs.oracle.com/cd/E19455-01/817-1592/gcgnc/index.html
那么说,在同一台服务器上将非全局区域从一个地方移到另一个地方的命令就是这样
zoneadm -z zonename move /some/new/pathname
这看起来相当麻烦…但是,如果非全局区域中有任何目录中的文件名中有一个特殊的(不是完全无关紧要的)字符的话,那么这个过程就会爆炸。 请允许我演示:
第一步:closures区域。 确保它被阻止:
# zlogin -C -e\@ z_001 [Connected to zone 'z_001' console] node002 console login: root Password: Last login: Sun Jul 21 05:12:17 on console Jul 25 17:50:06 node002 login: ROOT LOGIN /dev/console Oracle Corporation SunOS 5.10 Generic Patch January 2005 node002-sparc-SunOS5.10 # shutdown -g0 -y -i0 Shutdown started. Thu Jul 25 17:51:06 GMT 2013 Changing to init state 0 - please wait Broadcast Message from root (console) on node002 Thu Jul 25 17:51:07... THE SYSTEM node002 IS BEING SHUT DOWN NOW ! ! ! Log off now or risk your files being damaged node002-sparc-SunOS5.10 # showmount: node002: RPC: Program not registered svc.startd: The system is coming down. Please wait. svc.startd: 70 system services are now being stopped. syslogd: /dev/sysmsg: I/O error svc.startd: The system is down. [NOTICE: Zone halted] @. [Connection to zone 'z_001' console closed] #
伟大..现在来到zoneadm的举措:
# zoneadm -z z_001 move /zones/z_001 Moving across file-systems; copying zonepath /zone/z_001...zoneadm: zone 'z_001': 'copy' failed with exit code 5. The copy failed. More information can be found in /var/log/zoneAAAcwaOwX Cleaning up zonepath /zones/z_001... #
失败? 让我们看看为什么:
# cat /var/log/zoneAAAcwaOwX cpio: Error with fstatat() of "", errno 2, No such file or directory cpio: Error with fstatat() of "root/usr/local/build/automake-1.13_SunOS5.10_sparcv9/t/instspc.dir/a", errno 2, No such file or directory cpio: Cannot open directory b, errno 2, No such file or directory cpio: Error with fstatat() of "root/usr/local/build/automake-1.13_SunOS5.10_sparcv9/t/instspc.dir/a", errno 2, No such file or directory cpio: Error with fstatat() of "b", errno 2, No such file or directory 62026208 blocks 5 error(s) #
失败,因为cpio(zoneadm移动使用的东西)不能处理特殊字符。 如果有人下载GNU automake源代码压缩包并进行configuration,然后进行make检查,您将在testing包区域内看到一堆特殊字符。 这将导致Solaris上的cpio炸毁。
所以我希望有一些Solaris大师可以为我确认两件事情:
1) the only zone config file I need to edit is in /etc/zones 2) I can edit that one file myself and do the move of the zone filesystem myself also.
我对么 ?
编辑—-这是目录和cpio无法正确处理的字符:
# ls -lapb /zone/z_001/root/usr/local/build/automake-1.13_SunOS5.10_sparcv9/t/instspc.dir total 1398 drwxr-xr-x 2 gnuism other 3 Dec 31 2012 `/ drwxr-xr-x 2 gnuism other 2 Dec 31 2012 \012/ drwxr-xr-x 64 gnuism other 74 Dec 31 2012 ./ drwxr-xr-x 42 gnuism other 4045 Dec 31 2012 ../ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 '/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 "/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 $/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 \/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 &/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 #/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 a\012b/ -rw-r--r-- 1 gnuism other 38455 Dec 31 2012 aclocal.m4 lrwxrwxrwx 1 gnuism other 59 Dec 31 2012 ar-lib -> /usr/local/build/automake-1.13_SunOS5.10_sparcv9/lib/ar-lib drwxr-xr-x 2 gnuism other 7 Dec 31 2012 autom4te.cache/ drwxr-xr-x 3 gnuism other 6 Dec 31 2012 build-a_lf_b/ . . . drwxr-xr-x 2 gnuism other 2 Dec 31 2012 dest-tab/ drwxr-xr-x 2 gnuism other 2 Dec 31 2012 dest-tilde/ -rwxr-xr-x 1 gnuism other 13997 Dec 31 2012 install-sh -rw-r--r-- 1 gnuism other 1395 Dec 31 2012 Makefile.am -rw-r--r-- 1 gnuism other 39656 Dec 31 2012 Makefile.in -rwxr-xr-x 1 gnuism other 6873 Dec 31 2012 missing -rw-r--r-- 1 gnuism other 49 Dec 31 2012 source.c drwxr-xr-x 2 gnuism other 8 Dec 31 2012 sub/ drwxr-xr-x 2 gnuism other 3 Dec 31 2012 @&t@/ #
来自OP的说明:太糟糕了OpenSolaris项目被Oracle杀死了,因为我们可以很容易地看到,zoneadm如何使用cpio调用,并将其改为使用远远不够的任务。 我自己动手解决了这个问题,并使用JörgSchilling的“star”或POSIX Standard TAR来做zonemove。
Solution : 1 - Manually do the copy with a better tool from the source to dest. 1.1 - get sources for star from ftp://ftp.berlios.de/pub/schily/ 1.2 - extract them 1.3 - cd into the extracted star sources and run /usr/xpg4/bin/make 1.4 - once that ends just run /usr/xpg4/bin/make install you now have star and it can handle anything that lives on a filesystem 1.5 - do a copy from source to dest path with star /opt/schily/bin/star -copy -p -acl -sparse -dump -C source . dest 2 - cd to /etc/zones and edit the zonefile xml to use the new zonepath 3 - edit the "index" file in /etc/zones to use the new zonepath Special Detail to note : 1 - if you edit the zone XML file but do not edit the zonepath in the index file you will get a warning message when you try to boot the zone : # zoneadm -z z_001 boot The XML repository has zonepath '/z/001', but the index file has zonepath '/zone/z_001'. These must match, so fix the incorrect entry.
可选:通过ZFS复制,然后更改区域path。
使用你的参数:
我们有以下的程序:
zfs snapshot zone/z_001@premove : zfs snapshot zone/z_001@premove zfs send zone/z_001@premove | zfs recv zones/z_001 zfs send zone/z_001@premove | zfs recv zones/z_001 zoneadm -z z_001 detach zonecfg -z z_001 set zonepath=/zones/z_001 zoneadm -z z_001 attach区域: zoneadm -z z_001 attach 步骤4-6为你更改/ etc / zones / index。
您不必先closures该区域; 您可以拍摄并发送快照,然后将其closures,然后拍摄并发送第二个快照,该快照将是增量式的,并且更小更快: zfs send -i zone/z_001@premove zone/z_001@snap2 | zfs recv zones/z_001 zfs send -i zone/z_001@premove zone/z_001@snap2 | zfs recv zones/z_001
您最终还会在目标zpool上获取快照,您可以随时保留或删除这些快照。