这似乎是一件简单的事情,如果它只能像文档一样工作的话。但是,由于zoneadm移动过程中的一些bug,它无法工作。去想一想。首先,让我展示一下这些琐碎的文档是怎么说的:
http://docs.oracle.com/cd/E19455-01/817-1592/gcgnc/index.html这就是说,将非全局区域从一个位置移动到另一个位置的命令在同一台服务器上都是简单的。
zoneadm -z zonename move /some/new/pathname看起来很微不足道..。但是,如果非全局区域中有任何内容,其中一个目录在文件名中有特殊(不完全是微不足道的ascii )字符,那么进程就会崩溃。请允许我证明:
第一步:关闭区域。因此确保其停止:
# 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 -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源tarball并进行配置,然后使用make,您将看到测试套件区域中成堆的特殊字符。这将导致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项目被甲骨文杀死了,因为我们可以很容易地看到zoneadm是如何调用cpio的,并将其更改为使用远比任务更好的东西。我解决了这个问题,我自己做移动,并使用“星”或POSIX标准焦油来自约格先令做的区域。
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.发布于 2014-01-17 21:45:05
替代方案:通过ZFS复制,然后更改区域路径。
使用您的参数:
我们有以下程序:
zfs snapshot zone/z_001@premovezfs send zone/z_001@premove | zfs recv zones/z_001zoneadm -z z_001 detachzonecfg -z z_001 set zonepath=/zones/z_001zoneadm -z z_001 attach步骤4-6为您更改/etc/zone/index。
您不必先关闭区域;您可以获取并发送快照,然后关闭快照,然后获取并发送第二个快照,该快照将是增量式的,并且要小得多且速度更快:zfs send -i zone/z_001@premove zone/z_001@snap2 | zfs recv zones/z_001
最后,您也将获得目标zpool上的快照,您可以保留或删除该快照。
https://serverfault.com/questions/526601
复制相似问题