打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
使用 alt_disk_copy 实现硬件迁移

在 IBM Bluemix 云平台上开发并部署您的下一个应用。

开始您的试用

在 2009 年,我写了一篇文章介绍如何使用 alt_disk_copy(参见 参考资料 部分)克隆 rootvg 磁盘,以便在执行位于 rootvg 磁盘上的 AIX? 升级或应用程序升级时轻松实现恢复。在那篇文章中,我并没有介绍硬件迁移,因为这超出了那篇文章的范围。但在本文中,我将介绍如何实现硬件迁移。alt_disk_copy 的手册页(使用 “O” 选项)表明,可以 “在目标 altinst_rootvg 上执行设备重置。这会导致备用磁盘安装不保留任何用户定义的设备配置。如果一个或多个目标磁盘成为不同系统的 rootvg,那么此标志会很有用。”

在本质上,这意味着其属性发生更改(通常由系统管理员执行)的任何设备都会重置到默认值。这可能表明(但不限于)对以下内容的任何更改:

  • 以太网卡:重置 IP 地址/主机名
  • 光纤 (SAN) 卡:重置任何属性更改,比如 fc_err_recov
  • sys0:重置任何属性更改,比如 maxuproc
  • 重置 diag 硬件电子邮件通知列表

使用克隆的 rootvg 磁盘的方法迁移或移动硬件的过程依赖于您的操作需求。最常见的做法是克隆一个 rootvg 磁盘,将它插入新机器上,获得一个新的基础构建版本。这个过程可通过仍在运行的源机器完成。这的确很实用,可是一旦遇到克隆的磁盘,就需要镜像该磁盘,在源机器上插入一个新磁盘,然后重新镜像该磁盘,这样源机器上就不会出现中断。

但是,在此演示中,我将介绍可用于迁移到新硬件的过程。将来自源机器的光纤卡转移到新机器上,以及 SAN 附加磁盘。作为一般规则,无需移除以太网卡,因为任何新机器应该都已有这些网卡。

检查您现有的配置

如果您仅关心如何克隆 rootvg 来构建一个基础的新机器,那么没有必要收集当前的配置。只有从当前硬件迁移到新硬件时,才必须使用配置清单来更改新系统上的属性。

当迁移到新硬件时,检查您的 inittab 设置,注释掉您在迁移完成之前不需要提及的服务。同样明智的是,获取当前 AIX 机器的配置清单,这样, alt_disk_copy 重置的任何更改在新系统上线后都会更改。

以下不是您在迁移时需要在新系统上检查和修改的完整配置清单,但是这是一个不错的起点:

  • 所有 VG 及其 LV 内容的清单
  • 所有 PV 的清单
  • 所有光纤和 scsi 卡的 lsattr -El 输出
  • 对于 aio 服务器,在 AIX 6 和 7 上使用:ioo -a
  • 对于 aio 服务器,在 5.3 及更低版本上使用:lsattr -El aio0
  • 以太网卡清单(包括 ether-channel,如果存在)
  • 记录 IP 和网关地址
  • lscfg -vp 输出
  • lsdev 输出(即:lsdev -Cc disk)

准备迁移

在此演示中,您可以假设:

  • alpha 是源主机。
  • bravo 是目标主机。

建立镜像

在主机 alpha 上,确保 rootvg 已镜像。在此演示中,我们可以看到 rootvg 未完全镜像,/opt/db2_09_01 只有一个副本。所以,您需要修复之前未镜像的 rootvg。

# lsvg -l rootvgrootvg:LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINThd5                 boot       1       2       2    closed/syncd  N/Ahd6                 paging     4       8       2    open/syncd    N/Ahd8                 jfs2log    1       2       2    open/syncd    N/Ahd4                 jfs2       8       16      2    open/syncd    /hd2                 jfs2       36      72      2    open/syncd    /usrhd9var              jfs2       3       6       2    open/syncd    /varhd3                 jfs2       16      32      2    open/syncd    /tmphd1                 jfs2       8       16      2    open/syncd    /homehd10opt             jfs2       6       12      2    open/syncd    /opthd11admin           jfs2       1       2       2    open/syncd    /adminlg_dumplv           sysdump    8       16      1    open/syncd    N/Alivedump            jfs2       2       4       2    open/syncd    /var/adm/ras/livedumpfwdump              jfs2       1       2       2    open/syncd    /var/adm/ras/platformfslv01              jfs2       8       8       1    open/syncd    /opt/db2_09_01loglv01             jfslog     1       2       2    open/syncd    N/A# mklvcopy fslv01 2# syncvg -l fslv01# lsvg -l rootvgrootvg:LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINThd5                 boot       1       2       2    closed/syncd  N/Ahd6                 paging     4       8       2    open/syncd    N/Ahd8                 jfs2log    1       2       2    open/syncd    N/Ahd4                 jfs2       8       16      2    open/syncd    /hd2                 jfs2       36      72      2    open/syncd    /usrhd9var              jfs2       3       6       2    open/syncd    /varhd3                 jfs2       16      32      2    open/syncd    /tmphd1                 jfs2       8       16      2    open/syncd    /homehd10opt             jfs2       6       12      2    open/syncd    /opthd11admin           jfs2       1       2       2    open/syncd    /adminlg_dumplv           sysdump    8       16      1    open/syncd    N/Alivedump            jfs2       2       4       2    open/syncd    /var/adm/ras/livedumpfwdump              jfs2       1       2       2    open/syncd    /var/adm/ras/platformfslv01              jfs2       8       16      2    open/syncd    /opt/db2_09_01loglv01             jfslog     1       2       2    open/syncd    N/A

确认您的启动映像正常并已镜像,否则,alt_disk_copy 会失败:

# lslv -m hd5hd5:N/ALP    PP1  PV1               PP2  PV2               PP3  PV30001  0001 hdisk0            0001 hdisk1

识别要迁移的磁盘

在 alt_disk 执行之前,在物理上标识将移除的磁盘是一个谨慎之举。使用 smit 实用程序还是 smit diag 来识别磁盘位置(使用菜单选择)取决于您的磁盘位置:

smit diagtask selectionidentify /attention indicator

确保您知道哪个是 hdisk0 和 hdisk1。这里,一个有用的技巧是:在每个驱动器上贴一个较小的标签,标注响应的硬盘名称,这样您就可以确保不会移除错误的磁盘。在此演示中,我们最初会将 hdisk1 移动到新硬件上,所以应该首先找到 hdisk1 位置代码,请使用以下代码:

# lscfg -vp |grep -w hdisk1  hdisk1           U787F.001.DPM0Y7F-P1-T10-L4-L0   16 Bit LVD SCSI Disk Drive (18200 MB)

现在使用 smit diag,使用上面的 hdisk1 位置代码匹配您想要识别的设备位置代码。一旦 hdisk1 灯点亮,便可在其上贴上标签以供参考。

接下来,请执行以下步骤:

  • 运行 bosboot
  • 运行 unmirrorvg rootvg
  • 运行 reducevg rootvg 以删除 hdisk1
# bosboot -a# unmirrorvg rootvg hdisk10516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c <diskname>'        as root user to clear the boot record and avoid a potential boot        off an old boot image that may reside on the disk from which this        logical volume is moved/removed.0516-1804 chvg: The quorum change takes effect immediately.0516-1144 unmirrorvg: rootvg successfully unmirrored, user should perform        bosboot of system to reinitialize boot records.  Then, user must modify        bootlist to just include:  hdisk0.# reducevg rootvg hdisk1# lspvhdisk0          00c23bed7c1b3d4b                    rootvg          activehdisk1          00c23bedf2976238                    Nonehdisk2          00525c6a888e32cd                    apps_vg         active

启动 alt_disk_copy

现在,我可以克隆 rootvg(也就是 hdisk0)中当前的 AIX 到 hdisk1。alt_disk_copy 的格式为:

alt_disk_copy -Od hdisk1

其中:

  • 如前所述,O 会删除所有用户定义的 ODM 条目。
  • d 是克隆的 rootvg 磁盘的目标磁盘;在此示例中,它为 hdisk1。

您也可以指定 bootlist 选项,但我更喜欢自行控制启动项,将这作为迁移过程中的检查列表的一部分。清单 1 包含运行 alt_disk_copy 命令的完整输出。

清单 1. alt_disk 输出
# alt_disk_copy -Od hdisk1Calling mkszfile to create new /image.data file.Checking disk sizes.Creating cloned rootvg volume group and associated logical volumes.Creating logical volume alt_hd5Creating logical volume alt_hd6Creating logical volume alt_hd8Creating logical volume alt_hd4Creating logical volume alt_hd2Creating logical volume alt_hd9varCreating logical volume alt_hd3Creating logical volume alt_hd1Creating logical volume alt_hd10optCreating logical volume alt_hd11adminCreating logical volume alt_lg_dumplvCreating logical volume alt_livedumpCreating logical volume alt_fwdumpCreating logical volume alt_fslv01Creating logical volume alt_loglv01Creating logical volume alt_lv00Creating /alt_inst/ file system./alt_inst filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/admin file system./alt_inst/admin filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/home file system./alt_inst/home filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/opt file system./alt_inst/opt filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/opt/db2_09_01 file system./alt_inst/opt/db2_09_01 filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/storix file system.Creating /alt_inst/tmp file system./alt_inst/tmp filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/usr file system./alt_inst/usr filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/var file system./alt_inst/var filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/var/adm/ras/livedump file system./alt_inst/var/adm/ras/livedump filesystem not converted.        Small inode extents are already enabled.Creating /alt_inst/var/adm/ras/platform file system./alt_inst/var/adm/ras/platform filesystem not converted.        Small inode extents are already enabled.Generating a list of filesfor backup and restore into the alternate file system...Backing-up the rootvg files and restoring them to thealternate file system...Modifying ODM on cloned disk.Building boot image on cloned disk.Resetting all device attributes.NOTE: The first boot from altinst_rootvg will prompt to define the newsystem console.Resetting all device attributes.NOTE: The first boot from altinst_rootvg will prompt to define the newsystem console.forced unmount of /alt_inst/var/adm/ras/platformforced unmount of /alt_inst/var/adm/ras/platformforced unmount of /alt_inst/var/adm/ras/platformforced unmount of /alt_inst/var/adm/ras/livedumpforced unmount of /alt_inst/var/adm/ras/livedumpforced unmount of /alt_inst/varforced unmount of /alt_inst/varforced unmount of /alt_inst/usrforced unmount of /alt_inst/usrforced unmount of /alt_inst/tmpforced unmount of /alt_inst/tmpforced unmount of /alt_inst/storixforced unmount of /alt_inst/opt/db2_09_01forced unmount of /alt_inst/opt/db2_09_01forced unmount of /alt_inst/optforced unmount of /alt_inst/optforced unmount of /alt_inst/homeforced unmount of /alt_inst/homeforced unmount of /alt_inst/adminforced unmount of /alt_inst/adminforced unmount of /alt_instforced unmount of /alt_instChanging logical volume names in volume group descriptor area.Fixing LV control blocks...Fixing file system superblocks...Bootlist is set to the boot disk: hdisk1 blv=hd5# lspvhdisk0          00c23bed7c1b3d4b                    rootvg          activehdisk1          00c23bedf2976238                    altinst_rootvg

执行 alt_disk_copy 之后,除非另外指定,否则默认的操作是将它的 bootlist 设置为它所在的磁盘 alt_disk;在本例中该磁盘为 hdisk1。我们需要小心谨慎,确保如果我们必须恢复迁移,主机 alpha 仍会重新启动回到 hdisk0。所以请将 bootlist 更改为 hdisk0:

# bootlist -m normal hdisk0

然后关闭主机 alpha。

现在,我们可以保持主机 alpha 处于运行状态,然后使用以下命令动态删除该磁盘:

# rmdev -dl hdisk1

但是,最终我们需要关闭主机 alpha,以便移除剩余的 rootvg hdisk。所以我们现在也可以将它关闭。


回页首

启动克隆的磁盘

在此场景中,我们将主机 alpha 当前的硬件卡移除,将它们插入主机 bravo 中。主机 alpha 和 bravo 当前已关闭。

  • 移除网线和 SAN 光纤线缆(如果存在)以及光纤卡,并将这些卡插入到主机 bravo 中,然后连接上这些线缆。
  • 在主机 bravo 上,删除现有的(如果存在)内部启动磁盘,因为我们将替换主机 alpha 中的这些磁盘。
  • 在主机 alpha 上,移除 hdisk1 并将它插入到主机 bravo 中之前填充的启动磁盘的位置。
  • 启动主机 bravo;启动该主机后进入 SMS 菜单。

当启动主机 bravo 时,会显示固件/SMS 菜单提示。按 1 进入 SMS 菜单,如图 1 所示。

图 1. SMS

进入启动顺序列表,选择要启动的磁盘。应该只有一个磁盘要启动。图 2 显示了要启动的最新克隆的磁盘。

图 2. SMS 启动列表

启动该磁盘后,AIX 内核就会开始加载,如图 3 所示。磁盘开始启动并加载 AIX。

图 3. 启动

然后系统会提示您定义系统控制台,为此控制台选择 1,如图 4 所示。控制台定义已重置,因为它是一个 ODM 用户定义属性。

图 4. 标识新控制台

AIX 启动后,登录并检查磁盘:

# lspvhdisk0          00c23bedf2976238                    rootvg          active

请注意,主机 alpha 上名为 hdisk1 的磁盘现在在主机 bravo 上为 hdisk0。更改 bootlist 以启动此磁盘,直到迁移完成:

# bootlist -m normal hdisk0

将网络卡配置为主机 alpha 上使用的 IP,并根据需要配置网卡速度。确认您已连接到网络,进行相应的测试,以确保您可 ping 网关外部的地址,通过以下任何命令确保您可以连接 DNS:

nslookupdighost

确认您可以通过 telnet/ssh 从一个远程会话连接到主机 bravo。您可能必须在主机 bravo 上手动启动 ssh,因为它可能没有运行:

# startsrc -s sshd

引入其他 rootvg 磁盘

如果目前一切正常,我们可以从主机 alpha 引入其他 rootvg 磁盘:

  • 从主机 alpha 移除最后一个启动磁盘 (hdisk0)。
  • 将该磁盘插入主机 bravo 中,此磁盘现在为 hdisk1。
  • 运行 cfgmgr 来发现该磁盘。

我们目前还没有镜像该磁盘。首先,我们需要确保我们可以找到所有 SAN 磁盘。如果遇到相关问题,可以将新插入的磁盘放回原始机器中,以防我们需要恢复迁移。

如果 bravo 使用 old_rootvg 启动,只需使用以下命令删除该定义:

# alt_rootvg_op -X old_rootvg

检查硬件属性并引入 VG

在主机 bravo 上,在从 aio、sys0、scsi/光纤卡的输出获取的清单中检查可能需要完成的任何更改。通过 smit 或 chdev 命令调整这些设置。

发现光纤卡的 WWN。这可通过查看 lscfg -vp 命令的输出并搜索 SAN 卡 fcs0、fcs1 等来完成。获取之后,使用这些 WWN 从交换机重新对这些 SAN 磁盘分区,然后导入 VG。如果您有多个贯穿不同交换机的 SAN VG,我建议仅保留持有一个 VG 的交换机的线缆。使用 cfgmr 导入磁盘,然后导入该 VG。导入这些之后,请插入其他光纤,重新运行 cfgmgr 并导入该 VG。这么做的原因是:如果您不这么做,所有磁盘都将使用光纤路径。在导入 VG 后,所有磁盘都将导入一个 VG 上,这可能不是您想要的。(拥有多个 VG 的 scsi RAID 控制器不会遇到这类问题)。

如果使用 importvg 时遇到问题,请确保检查了附加的线缆。您可能必须在这之后运行 varyonvg,因为如果 AIX 在使用 importvg 时遇到问题,它不会自动运行 varyonvg。

接下来,请挂载文件系统。

# mount -a

通过检查来确保所有文件系统都已挂载,所有 LV 都已打开。

# lsvg -l <vg name>

取消对 inittab 进行的所有更改的注释。

刷新 iniitab,以便重新读取它。

# init q

现在启动应用程序并进行测试。

镜像

如果目前一切正常并且系统健康检查结果良好,则镜像其他磁盘。在将磁盘引入 rootvg 时,您需要使用 force 选项。

# extendvg -f rootvg hdisk1 # mirrorvg rootvg hdisk1

回页首

糟糕,全错了!

如果迁移或移动失败,则需要从主机 bravo 移除第二个(启动)磁盘。请记住,在所有应用程序测试结果正常之前,不应将这个磁盘放入主机 bravo 上的 rootvg 中。所以,这个磁盘仍然拥有来自户籍 alpha 的 ODM 设置,您可以顺利地进行恢复。只需反向使用文中描述的有关移动卡/线缆的流程。

在一些情形下,可能关闭磁盘时 alt_disk 标记仍然与它相关联。只需在将这个标记引入 rootvg 并建立镜像之前删除它即可。

# alt_rootvg_op -X altinst_rootvg

回页首

结束语

我重点介绍了一种硬件迁移方法。尽管这不是一个分步式指南,但它提供了一种执行迁移的方式。您可以采用不同的变体,使用 alt_disk_copy 执行硬件迁移或移动。alt_disk_copy 实用程序是一个不错的工具,在您希望迁移到新硬件并且所有机器都位于相同房间时,可以使用它。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
使用 alt_disk_copy 克隆 rootvg
快速复制系统-alt_disk_install入门
AIX视频学习笔记(现场版)
如何克隆rootvg
AIX.文件系统.存储管理.逻辑卷管理.PV.VG.PP.LV.LP
VIOS设计、安装、配置--之设计
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服