2009年,我写了一篇关于使用alt_disk_copy(参见相关主题部分)这样做对rootvg磁盘居住AIX®升级或应用程序升级时,你的克隆rootvg磁盘便于背出来的。 在那篇文章中,我没有介绍硬件迁移,因为这超出了范围。 在本文中,我将讨论如何实现这一目标。 alt_disk_copy上的手册页指出(通过使用'O'选项),“在目标altinst_rootvg上执行设备重置。这将导致备用磁盘安装不保留任何用户定义的设备配置。此标志在目标磁盘很有用或磁盘成为另一个系统的rootvg。”
简而言之,这意味着将属性(通常由系统管理员更改)的所有设备重置为默认值。 这可能意味着对以下内容进行任何更改,但不仅限于:
- 以太网卡-重置IP地址/主机名
- 光纤(SAN)卡-重置所有属性更改,例如fc_err_recov
- sys0-重置所有属性更改,例如maxuproc
- 重置diag硬件电子邮件通知列表
使用克隆的rootvg磁盘方法进行迁移或移动的过程取决于您的操作要求。 最常见的用途是克隆rootvg磁盘,然后将其插入新计算机以进行新的基础构建。 可以在源计算机仍在运行的情况下完成此过程。 实际上,一旦克隆的磁盘跨过,就可以对该磁盘进行镜像,然后在源上插入新磁盘,然后重新镜像该磁盘,这样就可以在源计算机上没有停机时间,这是实用的。
但是,在此演示中,我将指出一个可用于迁移到新硬件的过程。 将光纤卡从源计算机移至新计算机,以及SAN连接的磁盘。 通常,不需要删除以太网卡,因为任何新计算机都应该已经安装了这些以太网卡。
查看您现有的配置
迁移到新硬件时,请查看您的inittab设置,注释掉在迁移完成之前您不想使用的服务。 还建议获取当前AIX机器的配置列表,以便由alt_disk_copy重置并在启动新系统后进行更改的所有更改。
以下不是迁移时需要检查和修改新系统的配置列表的详尽列表,但这是一个不错的起点:
- 所有VG及其低压内容的清单
- 列出所有PV
- lsattr-所有光纤和scsi卡的El输出
- 对于aio服务器,在AIX 6和7上,ioo -a
- 对于5.3及以下版本的aio服务器,请使用:lsattr -El aio0
- 以太网卡列表(包括以太通道,如果有的话)
- 记下IP和网关地址
- lscfg -vp输出
- lsdev输出(即:lsdev -Cc磁盘)
准备搬家
在此演示中,您可以假定:
- alpha是源主机。
- bravo是目标主机。
被镜像
在主机alpha上,确保rootvg已镜像。 在此演示中,我们可以看到rootvg没有完全镜像,/ opt / db2_09_01只有一个副本。 因此,您需要先解决该问题,然后再取消rootvg的镜像。
# lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 4 8 2 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 8 16 2 open/syncd /
hd2 jfs2 36 72 2 open/syncd /usr
hd9var jfs2 3 6 2 open/syncd /var
hd3 jfs2 16 32 2 open/syncd /tmp
hd1 jfs2 8 16 2 open/syncd /home
hd10opt jfs2 6 12 2 open/syncd /opt
hd11admin jfs2 1 2 2 open/syncd /admin
lg_dumplv sysdump 8 16 1 open/syncd N/A
livedump jfs2 2 4 2 open/syncd /var/adm/ras/l
ivedump
fwdump jfs2 1 2 2 open/syncd /var/adm/ras/p
latform
fslv01 jfs2 8 8 1 open/syncd /opt/db2_09_01
loglv01 jfslog 1 2 2 open/syncd N/A
# mklvcopy fslv01 2
# syncvg -l fslv01
# lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 4 8 2 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 8 16 2 open/syncd /
hd2 jfs2 36 72 2 open/syncd /usr
hd9var jfs2 3 6 2 open/syncd /var
hd3 jfs2 16 32 2 open/syncd /tmp
hd1 jfs2 8 16 2 open/syncd /home
hd10opt jfs2 6 12 2 open/syncd /opt
hd11admin jfs2 1 2 2 open/syncd /admin
lg_dumplv sysdump 8 16 1 open/syncd N/A
livedump jfs2 2 4 2 open/syncd /var/adm/ras/l
ivedump
fwdump jfs2 1 2 2 open/syncd /var/adm/ras/p
latform
fslv01 jfs2 8 16 2 open/syncd /opt/db2_09_01
loglv01 jfslog 1 2 2 open/syncd N/A
确认您的启动映像是正确的并已镜像,否则alt_disk_copy将失败:
# lslv -m hd5
hd5:N/A
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0001 hdisk0 0001 hdisk1
识别要移动的磁盘
在执行alt_disk之前,最好先从物理上识别将要删除的磁盘。 根据磁盘的放置方式,使用热插拔smit实用程序或smit diag通过菜单选择来标识磁盘位置:
smit diag
task selection
identify /attention indicator
确保您知道哪个是hdisk0和hdisk1。 一个有用的提示是在每个驱动器上贴上一个小标签及其对应的hdisk名称,这样可以确保您不会删除错误的磁盘。 在此演示中,我们首先将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
- 取消rootvg
- reducevg rootvg删除hdisk1
# bosboot -a
# unmirrorvg rootvg hdisk1
0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c <disk
name>'
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
# lspv
hdisk0 00c23bed7c1b3d4b rootvg active
hdisk1 00c23bedf2976238 None
hdisk2 00525c6a888e32cd apps_vg active
启动alt_disk_copy
现在,我们可以从rootvg中的当前AIX克隆hdisk1,它是hdisk0。 alt_disk_copy的格式为:
alt_disk_copy -Od hdisk1
哪里:
- 如前所述,O删除所有用户定义的ODM条目。
- d是克隆的rootvg磁盘要移到的目标磁盘; 在此示例中,它是hdisk1。
您也可以指定启动列表选项,但是我希望在迁移过程中将其作为清单的一部分进行控制。 下面的清单1包含运行alt_disk_copy命令的完整输出。
清单。 1个alt_disk输出
# alt_disk_copy -Od hdisk1
Calling mkszfile to create new /image.data file.
Checking disk sizes.
Creating cloned rootvg volume group and associated logical volumes.
Creating logical volume alt_hd5
Creating logical volume alt_hd6
Creating logical volume alt_hd8
Creating logical volume alt_hd4
Creating logical volume alt_hd2
Creating logical volume alt_hd9var
Creating logical volume alt_hd3
Creating logical volume alt_hd1
Creating logical volume alt_hd10opt
Creating logical volume alt_hd11admin
Creating logical volume alt_lg_dumplv
Creating logical volume alt_livedump
Creating logical volume alt_fwdump
Creating logical volume alt_fslv01
Creating logical volume alt_loglv01
Creating logical volume alt_lv00
Creating /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 files
for backup and restore into the alternate file system...
Backing-up the rootvg files and restoring them to the
alternate 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 new
system console.
Resetting all device attributes.
NOTE: The first boot from altinst_rootvg will prompt to define the new
system console.
forced unmount of /alt_inst/var/adm/ras/platform
forced unmount of /alt_inst/var/adm/ras/platform
forced unmount of /alt_inst/var/adm/ras/platform
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var
forced unmount of /alt_inst/var
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/storix
forced unmount of /alt_inst/opt/db2_09_01
forced unmount of /alt_inst/opt/db2_09_01
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/home
forced unmount of /alt_inst/home
forced unmount of /alt_inst/admin
forced unmount of /alt_inst/admin
forced unmount of /alt_inst
forced unmount of /alt_inst
Changing 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
# lspv
hdisk0 00c23bed7c1b3d4b rootvg active
hdisk1 00c23bedf2976238 altinst_rootvg
执行alt_disk_copy后,除非另有说明,否则默认操作是将其引导列表设置为其所在的磁盘alt_disk; 在这种情况下,它是hdisk1。 我们需要特别注意,以确保主机alpha仍将重新引导回hdisk0,以防我们不得不退出迁移。 因此,将引导列表更改为hdisk0:
# bootlist -m normal hdisk0
然后关闭主机alpha。
在这一点上,我们可以保持主机Alpha正常运行,并使用以下方法动态删除磁盘:
# rmdev -dl hdisk1
但是,最终我们需要关闭主机alpha才能删除剩余的rootvg hdisk。 因此,我们现在最好将其关闭。
引导克隆的磁盘
在这种情况下,我们将当前的硬件卡从主机alpha中移出并将其插入主机bravo中。 主机Alpha和Bravo当前关闭。
- 卸下网络电缆和SAN光纤电缆(如果有)以及光纤卡,并将这些卡插入主机Bravo; 然后插入电缆。
- 在主机bravo上,删除现有的内部引导磁盘(如果存在),因为我们将从主机alpha中替换它们。
- 在主机alpha上,删除hdisk1并将其插入先前启动磁盘所在位置的bravo主机中。
- 调动主人的勇气; 启动后,进入SMS菜单。
当主机bravo出现时,它将显示固件/ SMS菜单提示。 点击1进入SMS菜单,如图1所示。
图1. SMS
转到启动顺序列表,然后选择要启动的磁盘。 应该只有一个磁盘可以启动。 图2显示了要克隆的新克隆磁盘。
图2. SMS引导列表
启动该磁盘后,AIX内核开始加载,如图3所示。磁盘启动并加载AIX。
图3.启动
然后提示您定义系统控制台,为该控制台选择1,如图4所示。该控制台定义已被重置,因为它是ODM用户定义的属性。
图4.识别新控制台
启动AIX后,登录并检查磁盘:
# lspv
hdisk0 00c23bedf2976238 rootvg active
请注意,主机alpha上的正式名称hdisk1现在在主机bravo上为hdisk0。 将引导列表更改为该磁盘的引导,直到迁移完成:
# bootlist -m normal hdisk0
如果需要,将网卡配置为主机alpha上使用的IP和网卡速度。 确认您已连接到网络,进行测试以确保可以在网关外部ping,并确保可以通过以下任何命令连接到DNS:
nslookup
dig
host
确认您可以从远程会话通过telnet / ssh连接到bravo主机。 您可能必须在主机bravo上手动启动ssh,因为它可能没有运行:
# startsrc -s sshd
放入另一个rootvg磁盘
如果此时一切正常,我们可以从主机alpha引入另一个rootvg磁盘:
- 从主机alpha中删除最后一个启动磁盘(hdisk0)。
- 将磁盘插入主机bravo; 该磁盘现在为hdisk1。
- 运行cfgmgr以发现磁盘。
我们尚未镜像磁盘。 首先,我们需要确保我们发现了所有的SAN磁盘。 如果对此有疑问,我们可以将新插入的磁盘带回原始盒中,以防需要退出迁移。
审查硬件属性并引入VG
在主机bravo上,检查是否可能需要从aio,sys0,scsi /光纤卡的输出中获得的清单中进行任何更改。 通过smit或chdev命令调整这些设置。
发现光纤卡的WWN。 这是通过查看lscfg -vp命令的输出并搜索SAN卡fcs0,fcs1等获得的。一旦获得,就可以使用它们在交换机的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实用程序是一个很好的工具,当您希望迁移到新硬件并且计算机位于同一位置的房间中时。
翻译自: https://www.ibm.com/developerworks/aix/library/au-rootvgmigration/index.html