wwb
作者wwb·2013-08-06 14:04
系统架构师·zkr

使用alt_disk_copy命令 P2V 迁移(rootvg)

字数 18265阅读 3336评论 1赞 1

命令简介


alt_disk_copy 是一个内置的 AIX 实用程序,可以用它克隆正在运行的 rootvg.

因为 alt_disk_copy 命令把当前正在运行的 rootvg 复制到另一个磁盘,所以一定要挂载希望克隆的所有文件系统。alt_disk_copy 只复制 rootvg 中当前挂载的文件系统。执行 rootvg 不需要停止进程;但是,这个过程要花费一段时间,所以最好在午餐时或晚上执行(请记住,它复制正在运行的 rootvg)。复制完成之后,就有了两个 rootvg 卷组:rootvg  altinst_rootvg


迁移思路 思路其实很简单,P2V,就是做虚拟化,方便使用云来管理,也就是把本地盘的数据,copy 到存储池里面去,把物理资源用虚拟资源来代替。
   该例中本来就是做好虚拟化了,只是系统和数据在本地盘上,因此只需要把本地盘的数据,copy 到存储池即可。


需要迁移的源机器

1.Lsvg rootvg 查看rootvg 的大小。

# lsvg rootvg

VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00f7cabb00004c000000013e7c2c4244

VG STATE:           active                   PP SIZE:        512 megabyte(s)

VG PERMISSION:      read/write               TOTAL PPs:      599 (306688 megabytes)

MAX LVs:            256                      FREE PPs:       178 (91136 megabytes)

LVs:                19                      USED PPs:      421 (215552 megabytes)

OPEN LVs:           18                       QUORUM:         2 (Enabled)

TOTAL PVs:          1                        VG DESCRIPTORS: 2

STALE PVs:          0                        STALE PPs:      0

ACTIVE PVs:         1                       AUTO ON:        no

MAX PPs per VG:     32512                                    

MAX PPs per PV:     1016                     MAX PVs:        32

LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no

HOT SPARE:          no                       BB POLICY:      relocatable

2.从磁阵映射一块大小略大于 USED PPs 大小的逻辑盘给需要迁移的机器。此处要记录好pviduniqueid 来确保下一步中映射给VIOS的盘是同一个盘。

# lspv

hdisk0          00f7cabb7064dd0e                    rootvg          active

hdisk1          00f7b5c4ed7ce0a1                    rootvg          active

hdisk2          00f7cabb7bc1c752                    none           active


3.输入alt_disk_copy -d hdisk2,进行复制。


# alt_disk_copy -d hdisk2

Calling mkszfile to create new /image.datafile.

Checking disk sizes.

Creating cloned rootvg volume group andassociated 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_lvoracle

Creating logical volume alt_lvoracle11

Creating logical volume alt_lvtt

Creating logical volume alt_lvsoft

Creating logical volume alt_fslv00

Creating logical volume alt_fslv01

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/export/lpp_source filesystem.

/alt_inst/export/lpp_source filesystem notconverted.

       Small inode extents are already enabled.

Creating /alt_inst/export/spot file system.

/alt_inst/export/spot filesystem notconverted.

       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/oracle file system.

/alt_inst/oracle filesystem not converted.

       Small inode extents are already enabled.

Creating /alt_inst/oracle11 file system.

/alt_inst/oracle11 filesystem notconverted.

       Small inode extents are already enabled.

Creating /alt_inst/soft file system.

/alt_inst/soft filesystem not converted.

       Small inode extents are already enabled.

Creating /alt_inst/tmp file system.

/alt_inst/tmp filesystem not converted.

       Small inode extents are already enabled.

Creating /alt_inst/tt file system.

/alt_inst/tt 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/livedumpfile system.

/alt_inst/var/adm/ras/livedump filesystemnot converted.

       Small inode extents are already enabled.

        Small inode extents are already enabled.

Generating a list of files

for backup and restore into the alternatefile system...

Backing-up the rootvg files and restoringthem to the

alternate file system...  (该步骤进行了近一个小时,该例中rootvg有近300G)


0505-148 alt_disk_install: WARNING: anerror occurred during backup.

Modifying ODM on cloned disk.

Building boot image on cloned disk.

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/tt

forced unmount of /alt_inst/tt

forced unmount of /alt_inst/tmp

forced unmount of /alt_inst/tmp

forced unmount of /alt_inst/soft

forced unmount of /alt_inst/soft

forced unmount of /alt_inst/oracle11

forced unmount of /alt_inst/oracle11

forced unmount of /alt_inst/oracle

forced unmount of /alt_inst/oracle

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/export/spot

forced unmount of /alt_inst/export/spot

forced unmount of/alt_inst/export/lpp_source

forced unmount of/alt_inst/export/lpp_source

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 volumegroup descriptor area.

Fixing LV control blocks...

Fixing file system superblocks...

Bootlist is set to the boot disk: hdisk2blv=hd5



4.执行过程中,复制的盘会加到altinst_rootvg

# lspv

hdisk0          00f7cabb7064dd0e                    rootvg          active

hdisk1          00f7b5c4ed7ce0a1                    rootvg          active

hdisk2          00f7cabb7bc1c752                    altinst_rootvg  active

5.复制完成后,执行rmdev –dl hdisk2 删除该盘。





VIOS

1.将之前复制好的LUN 映射给VIOS

# lsattr -Elhdisk7

PCM             PCM/friend/fcpother                                 Path ControlModule              False

algorithm       fail_over                                          Algorithm                        True

clr_q           no                                                 Device CLEARS its Queue on error True

dist_err_pcnt   0                                                  Distributed Error Percentage    True

dist_tw_width   50                                                 Distributed Error Sample Time   True

hcheck_cmd      test_unit_rdy                                       HealthCheck Command             True

hcheck_interval60                                                  Health Check Interval            True

hcheck_mode     nonactive                                          Health Check Mode               True

location                                                           Location Label                   True

lun_id          0x1000000000000                                     LogicalUnit Number ID           False

lun_reset_spt   yes                                                LUN Reset Supported             True

max_retry_delay60                                                  Maximum QuiesceTime             True

max_transfer    0x40000                                            Maximum TRANSFER Size           True

node_name       0x5005076802002b38                                  FC NodeName                     False

pvid            none                                               Physical volume identifier      False

q_err           yes                                                Use QERR bit                    True

q_type          simple                                             Queuing TYPE                    True

queue_depth     8                                                  Queue DEPTH                     True

reassign_to     120                                                 REASSIGN time out value          True

reserve_policy  single_path                                        Reserve Policy                  True

rw_timeout      30                                                 READ/WRITE time out value       True

scsi_id         0x10200                                            SCSI ID                         False

start_timeout   60                                                 START unit time out value       True

unique_id       332136005076802818101840000000000009404214503IBMfcpUnique device identifier         False

ww_name         0x5005076802302b38                                  FC World WideName               False


2.映射好了后,执行cfgmgr发现。


3.然后使用mkvdev –vdev hdisk7 –vadapter vhost0 –dev 4.155

4.使用lsmap –all查看。


$ lsmap -all

SVSA            Physloc                                      ClientPartition ID

----------------------------------------------------------- ------------------

vhost0          U8205.E6C.06CABBR-V1-C11                     0x00000002

VTD                   4.155

Status                Available

LUN                   0x8400000000000000

Backing device        hdisk7

Physloc              U78AA.001.WZSHS25-P1-C2-T1-W5005076802302B38-L1000000000000

Mirrored              false






虚拟机

1.HMC上激活概要文件,使用SMS方式启动。

7.png

8.png


9.png


10.png


可以看出来,红框中的是有拷贝的哪个盘。

11.png


2.启动进入系统后,执行lsvg 可以看到之前的rootvg 变成了 old_rootvg(两块本地盘)

# lsvg

old_rootvg

rootvg

#

#

# lsvg -p rootvg

rootvg:

PV_NAME           PV STATE          TOTAL PPs   FREE PPs   FREE DISTRIBUTION

hdisk2            active            599         216         79..24..00..00..113

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

1

添加新评论1 条评论

zibing6688zibing6688系统工程师EDI
2023-05-24 11:07
十分感谢你的帖子,帮大忙了。
Ctrl+Enter 发表

作者其他文章

X社区推广