Monday, July 4, 2011

Cloning an LPAR using an ISO via VIO Virtual Media Library

Cloning an LPAR using VIO Virtual Media Library

This is a short howto on cloning an AIX LPAR using the
VIO Virtual Media Library. An ISO file will be created
from an AIX mksysb image of the source LPAR. This
iso file is then loaded thru the VIO server as a
virtual optical device to be used by the target LPAR.

For this howto, the mksysb and ISO files were created
on the same LPAR. This is not a requirement.Just make
sure ISO generation is on a system that is at least
the same level as the mksysb's source.


CREATE THE MKSYSB IMAGE

[root@HESTIA]/>mksysb -eim /export/mksysb/AIX53TL12SP1.img

Creating information file (/image.data) for rootvg.

Creating list of files to back up ..
Backing up 124218 files....................

124218 of 124218 files backed up (100%)
0512-038 mksysb: Backup Completed Successfully.

[root@HESTIA]/>du -ms /export/mksysb/AIX53TL12SP1.img
2923.00 /export/mksysb/AIX53TL12SP1.img

I have excluded directories to reduce size of mksysb image. Also,
/export is from another volumen group.



CREATE THE ISO IMAGE

[root@HESTIA]/> mkcd -L -S -I /export/iso/ -m /export/mksysb/AIX53TL12SP1.img

from mkcd man page:

-L creates final CD images that are DVD sized (up to 4.38 GB)
-S stops mkcd before writing to the CD-R, DVD-R or DVD-RAM 
 without removing the final CD images.
-I cd_image_dir specifies the directory or file system where
 the final CD images are stored before writing to 
 the CD-R, DVD-R or DVD-RAM device.
-m mksysb_image specifies a previously created mksysb image. 
 if not specified, mkcd will run the mksysb command.


[root@HESTIA]/> mkcd -L -S -I /export/iso/ -m /export/mksysb/AIX53TL12SP1.img

Initializing mkcd log: /var/adm/ras/mkcd.log...
Verifying command parameters...
Creating temporary file system: /mkcd/cd_fs...
Populating the CD or DVD file system...
Building chrp boot image...
Copying backup to the CD or DVD file system...
...
Creating Rock Ridge format image: /export/iso//cd_image_299194
Running mkisofs ...
...
mkrr_fs was successful.

Making the CD or DVD image bootable...


Removing temporary file system: /mkcd/cd_fs...



VIO SIDE
as padmin, create the Repository on the VIO server

$ lsrep
The DVD repository has not been created yet.

$ lssp
Pool              Size(mb)   Free(mb)  Alloc Size(mb)    BDs Type
rootvg              279552     222464             256      0 LVPOOL

$ mkrep -sp rootvg -size 9G
Virtual Media Repository Created
Repository created within "VMLibrary" logical volume

NOTE: a new FS /var/vio/VMLibrary will be created and mounted.

then as root, copy the CD ISO image:

# pwd
/var/vio/VMLibrary
# scp ZEUS:/Apps/iso/cd_image_545020 AIX53TL12.iso
root@ZEUS's password:
cd_image_545020                                                             100% 3264MB  35.1MB/s   01:33
# ls -ltr
total 15809960
-r--r--r--    1 root     staff    3129395200 Jun 25 09:00 AIX53TL12SP1.iso
-r--r--r--    1 root     staff    3422056448 Jun 25 09:00 AIX53TL12.iso
-r--r--r--    1 root     staff    1543245824 Jul 04 09:00 AIX61TL4SP7.iso

List the pool:
$ lsrep
Size(mb) Free(mb) Parent Pool         Parent Size      Parent Free
    9179     1458 rootvg                   279552           222464

Name                                    File Size Optical         Access
AIX53TL12.iso                                3264 None            ro
AIX53TL12SP1.iso                             2985 None            ro
AIX61TL4SP7.iso                              1472 None            ro


create the adapter

$ mkvdev -fbo -vadapter vhost1
vtopt0 Available

from mkvdev man page:

The -fbo flag is used to create a virtual target device which maps 
the VirtualServerAdapter to a file backed virtual optical device. 
Virtual optical devices cannot be used until virtual media is 
loaded into the device.


$ lsmap -vadapter vhost1
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost1          U8233.E8B.0633B8P-V1-C4                      0x00000003

VTD                   vtopt0
Status                Available
LUN                   0x8100000000000000
Backing device
Physloc
Mirrored              N/A


load the image:

$ mkvdev -fbo -vadapter vhost1
vtopt0 Available

$ loadopt -f -vtd vtopt0 -disk AIX53TL12SP1.iso

$ lsrep
Size(mb) Free(mb) Parent Pool         Parent Size      Parent Free
    9179     1458 rootvg                   279552           222464

Name                                    File Size Optical         Access
AIX53TL12.iso                                3264 None            ro
AIX53TL12SP1.iso                             2985 vtopt0          ro
AIX61TL4SP7.iso                              1472 None            ro

$ lsmap -vadapter vhost1
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost1          U8233.E8B.0633B8P-V1-C4                      0x00000003

VTD                   HESTIAsys00
Status                Available
LUN                   0x8200000000000000
Backing device        hdisk5
Physloc               U5796.001.0620413-P1-C1-T1-W50001FE1501C6C69-L2000000000000
Mirrored              false

VTD                   vtopt0
Status                Available
LUN                   0x8100000000000000
Backing device        /var/vio/VMLibrary/AIX53TL12SP1.iso
Physloc
Mirrored              N/A

then boot the LPAR from the scsi device detected

 SMS 1.7 (c) Copyright IBM Corp. 2000,2008 All rights reserved.                 
------------------------------------------------------------------------------- 
 Select Task                                                                    
                                                                                
SCSI CD-ROM                                                                     
    ( loc=U8233.E8B.0633B8P-V3-C2-T1-L8100000000000000 )                        
                                                                                
 1.   Information                                                               
 2.   Normal Mode Boot                                                          
 3.   Service Mode Boot                                                         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
 -------------------------------------------------------------------------------
 Navigation keys:                                                               
 M = return to Main Menu                                                        
 ESC key = return to previous screen         X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:2               
                                                                                


 Version AL710_097                                                              
 SMS 1.7 (c) Copyright IBM Corp. 2000,2008 All rights reserved.                 
------------------------------------------------------------------------------- 
 Device Information                                                             
    /vdevice/v-scsi@30000002/disk@8100000000000000                              
                   :  (Bootable)                                                
DEVICE             : SCSI CD-ROM                                                
    ( loc=U8233.E8B.0633B8P-V3-C2-T1-L8100000000000000 )                        
NAME               : disk                                                       
DEVICE-TYPE        : block                                                      
                                                                                
 Parent Information                                                             
IBM,FW-ADAPTER-NAME: Virtual SCSI                                               
NAME               : v-scsi                                                     
DEVICE-TYPE        : vscsi                                                      
                                                                                
                                                                                
                                                                                
                                                                                
 -------------------------------------------------------------------------------
 Navigation keys:                                                               
 M = return to Main Menu                                                        
 ESC key = return to previous screen         X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:                


IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM     
|                                                                               
Elapsed time since release of system processors: 352759 mins 32 secs            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
------------------------------------------------------------------------------- 
                                Welcome to AIX.                                 
                       boot image timestamp: 07:07 07/04                        
                 The current time and date: 08:35:48 07/04/2011                 
               number of processors: 2    size of memory: 4096MB                
boot device: /vdevice/v-scsi@30000002/disk@8100000000000000:\ppc\chrp\bootfile.e
                     kernel size: 12544763; 32 bit kernel                       
------------------------------------------------------------------------------- 



Once done with the image, unload it:

$ unloadopt -release -vtd vtopt0

$ lsmap -vadapter vhost1
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost1          U8233.E8B.0633B8P-V1-C4                      0x00000003

VTD                   HESTIAsys00
Status                Available
LUN                   0x8200000000000000
Backing device        hdisk5
Physloc               U5796.001.0620413-P1-C1-T1-W50001FE1501C6C69-L2000000000000
Mirrored              false

VTD                   vtopt0
Status                Available
LUN                   0x8100000000000000
Backing device
Physloc
Mirrored              N/A


and if the Virtual adapter is no longer needed:

$ rmdev -dev vtopt0
vtopt0 deleted
$ lsmap -vadapter vhost1

0 comments:

Post a Comment