Search This Blog

Monday, June 24, 2013

Making a Bootable VxVM Copy of an LVM Boot Disk

•    System should be at run level 1
•    swagentd has to be running
•    Use the command /etc/vx/bin/vxcp_lvmroot
o    Initializes a specified physical disk as a VxVM root disk named rotodisk## (where ## is the first number starting at 01 that creates a unique disk name)
o    Copies the contents of the volumes on the LVM root disk to the new VxVM root disk.
o    Optionally creates a mirror of the VxVM root disk on another specified physical disk.
•    Options for vxcp_lvmroot
o    –b sets primary and/or alternate boot paths
o    –v verbose
o    –R reduce file system sizes by percent
o    –m creates a root mirror of the VxVM copy
•    Example using all of the options”
# /etc/vx/bin/vxcp_lvmroot –m c4t6d0 –R 20 –v –b c3t5d0
o    creates a VxVM copy of the current LVM boot disk to c3t5d0
o    reduce each volume/filesystem size on the copy by 20%
o    sets the primary boot path to c3t5d0
o    makes a mirrored VxVM boot disk on c4t6d0
o    sets the alternate boot path to c4t6d0

The above recommendation to run vxcp_lvmroot at run level 1 does not work without starting a few services.

# /sbin/init.d/net.init start
#/sbin/init.d/net start
#/sbin/init.d/swagentd start
#/etc/vx/bin/vxcp_lvmroot –m c4t6d0 –R 20 –v –b c3t5d0


The following exampled shows how to setup up a VxVM root disk on physical disk c3t2d0

# bdf
Filesystem          kbytes    used   avail %used Mounted on
/dev/vx/dsk/rootdg/rootvol
                   1048576  414917  594082   41% /
/dev/vx/dsk/rootdg/standvol
                   2064384  325562 1630233   17% /stand
/dev/vx/dsk/rootdg/varvol
                   8388608  702152 7206179    9% /var
/dev/vx/dsk/rootdg/usrvol
                   8388608 2667083 5364031   33% /usr
/dev/vx/dsk/rootdg/tmpvol
                    524288   17379  475359    4% /tmp
/dev/vx/dsk/rootdg/optvol
                   8388608 4377947 3760007   54% /opt
/dev/vx/dsk/rootdg/homevol
                    131072    1662  121326    1% /home
DevFS                    3       3       0  100% /dev/deviceFileSystem

# vxdisk list
DEVICE       TYPE            DISK         GROUP        STATUS
c2t0d0s2     auto:hpdisk     -            -            online
c2t1d0s2     auto:LVM        -            -            LVM
c3t2d0s2     auto:hpdisk     rootdisk01   rootdg       online
c5t0d1       auto:cdsdisk    rootdg02     rootdg       online
c5t0d2       auto:cdsdisk    rootdg03     rootdg       online
c5t0d3       auto:cdsdisk    rootdg04     rootdg       online
c5t0d4       auto:cdsdisk    rootdg05     rootdg       online
c5t0d5       auto:cdsdisk    rootdg06     rootdg       online
c5t0d6       auto:cdsdisk    rootdg07     rootdg       online
c5t0d7       auto:cdsdisk    rootdg08     rootdg       online
c5t1d0       auto:cdsdisk    rootdg01     rootdg       online

# /etc/vx/bin/vxcp_lvmroot -v -b c3t2d0
VxVM vxcp_lvmroot INFO V-5-2-4668 01:13: Bootdisk is configured with new-style DSF
VxVM vxcp_lvmroot INFO V-5-2-2499 01:13: Gathering information on LVM root volume group vg00
VxVM vxcp_lvmroot INFO V-5-2-2441 01:13: Checking specified disk(s) for usability
VxVM vxcp_lvmroot INFO V-5-2-4679 01:13: Using legacy-style DSF names
VxVM vxcp_lvmroot INFO V-5-2-2566 01:13: Preparing disk c3t2d0 as a VxVM root disk
VxVM vxcp_lvmroot INFO V-5-2-3767 01:13: Disk c3t2d0 is now EFI partitioned disk c3t2d0s2
VxVM vxcp_lvmroot INFO V-5-2-2537 01:13: Initializing DG rootdg with disk c3t2d0s2 as DM rootdisk01
VxVM vxcp_lvmroot INFO V-5-2-1606 01:13: Copying /dev/vg00/lvol1 (vxfs) to
/dev/vx/dsk/rootdg/standvol
VxVM vxcp_lvmroot INFO V-5-2-1604 01:13: Cloning /dev/vg00/lvol2 (swap) to
/dev/vx/dsk/rootdg/swapvol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:13: Copying /dev/vg00/lvol3 (vxfs) to
/dev/vx/dsk/rootdg/rootvol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:14: Copying /dev/vg00/lvol4 (vxfs) to
/dev/vx/dsk/rootdg/tmpvol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:14: Copying /dev/vg00/lvol5 (vxfs) to
/dev/vx/dsk/rootdg/homevol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:14: Copying /dev/vg00/lvol6 (vxfs) to
/dev/vx/dsk/rootdg/optvol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:21: Copying /dev/vg00/lvol7 (vxfs) to
/dev/vx/dsk/rootdg/usrvol
VxVM vxcp_lvmroot INFO V-5-2-1606 01:24: Copying /dev/vg00/lvol8 (vxfs) to
/dev/vx/dsk/rootdg/varvol
VxVM vxcp_lvmroot INFO V-5-2-4678 01:25: Setting up disk c3t2d0s2 as a boot disk
VxVM vxcp_lvmroot INFO V-5-2-1638 01:25: Installing fstab and fixing dev nodes on new root
FS
rm: /tmpmnt.13911.30026//etc/vx/darecs non-existent
VxVM vxcp_lvmroot INFO V-5-2-2538 01:26: Installing bootconf & rootconf files in new stand
FS
VxVM vxcp_lvmroot INFO V-5-2-2462 01:26: Current setboot values:
VxVM vxcp_lvmroot INFO V-5-2-2569 01:26: Primary: 0/1/1/0.0x1.0x0 /dev/rdisk/disk70
VxVM vxcp_lvmroot INFO V-5-2-2416 01:26: Alternate:
VxVM vxcp_lvmroot INFO V-5-2-4676 01:26: Making disk /dev/rdisk/disk71_p2 the primary boot
disk
VxVM vxcp_lvmroot INFO V-5-2-4663 01:26: Making disk /dev/rdisk/disk70_p2 the alternate
boot disk
VxVM vxcp_lvmroot INFO V-5-2-4671 01:26: Disk c3t2d0s2 is now a VxVM rootable boot disk

Note: The –b option to vxcp_lvmroot uses the setboot command to define c3t2d0 as the primary boot device. If this option is not specified, the primary boot device is not changed.

If the destination VxVM root disk is not big enough to accommodate the contents of the LVM root disk, you can use the –R option to specify a percentage by which to reduce the size of the file systems on the target disk. (This takes advantage of the fact that most of these file systems are usually nowhere near 100% full.) For example, to specify a size reduction of 30%, the following command would be used:

# /etc/vx/bin/vxcp_lvmroot –R 30 -v -b c3t2d0s2

The next example uses the same command and additionally specifies the –m options to set up a root mirror on disk c2t0d0s2

# /etc/vx/bin/vxcp_lvmroot –m c2t0d0s2 –R 30 -v -b c3t2d0s2

In this example, the –b options to vxcp_lvmroot sets c3t2d0 as the primary boot device and c2t0d0 as the alternate boot device. This command is equivalent to using vxcp_lvmroot to create the VxVM-rootable disk, and then using the vxrootmir to create the mirror:

# /etc/vx/bin/vxcp_lvmroot -v -b c3t2d0s2
# /etc/vx/bin/vxrootmir –v –b c2t0d0s2

# /etc/vx/bin/vxrootmir -v -b c2t0d0s2
VxVM vxrootmir INFO V-5-2-2501 03:26: Gathering information on the current VxVMn
VxVM vxrootmir INFO V-5-2-2441 03:26: Checking specified disk(s) for usability
VxVM vxrootmir INFO V-5-2-4679 03:26: Using legacy-style DSF names
VxVM vxrootmir INFO V-5-2-2566 03:26: Preparing disk disk70_p2 as a VxVM root dk
VxVM vxrootmir INFO V-5-2-3766 03:26: Disk disk70_p2 is now EFI partitioned dis2
VxVM vxrootmir INFO V-5-2-2410 03:26: Adding disk disk70_p2 to rootdg as DM roo2
VxVM vxrootmir INFO V-5-2-1646 03:26: Mirroring all volumes on root disk
VxVM vxrootmir INFO V-5-2-1648 03:26: Mirroring volume standvol
VxVM vxrootmir INFO V-5-2-1648 03:27: Mirroring volume swapvol
VxVM vxrootmir INFO V-5-2-1648 03:31: Mirroring volume rootvol
VxVM vxrootmir INFO V-5-2-1648 03:31: Mirroring volume tmpvol
VxVM vxrootmir INFO V-5-2-1648 03:32: Mirroring volume homevol
VxVM vxrootmir INFO V-5-2-1648 03:32: Mirroring volume optvol
VxVM vxrootmir INFO V-5-2-1648 03:36: Mirroring volume usrvol
VxVM vxrootmir INFO V-5-2-1648 03:39: Mirroring volume varvol
VxVM vxrootmir INFO V-5-2-2462 03:43: Current setboot values:
VxVM vxrootmir INFO V-5-2-2569 03:43: Primary:  0/1/1/1.0x2.0x0 /dev/rdisk/disk1
VxVM vxrootmir INFO V-5-2-2416 03:43: Alternate:        0/1/1/0.0x1.0x0 /dev/rd9
VxVM vxrootmir INFO V-5-2-2551 03:43: Making mirror disk disk70 (/dev/rdisk/disk
Alternate boot path set to 0/1/1/0.0x0.0x0 (/dev/rdisk/disk70)
VxVM vxrootmir INFO V-5-2-1616 03:43: Disk c2t0d0 is now a mirrored root disk


The disk name assigned to the VxVM root disk mirror also uses the format rootdisk## with ## set to the next available number.

Before:
# setboot
Primary bootpath : 0/1/1/1.0x2.0x0 (/dev/rdisk/disk71)
HA Alternate bootpath :
Alternate bootpath : 0/1/1/0.0x1.0x0 (/dev/rdisk/disk69)

After:
# setboot
Primary bootpath : 0/1/1/1.0x2.0x0 (/dev/rdisk/disk71)
HA Alternate bootpath :
Alternate bootpath : 0/1/1/0.0x0.0x0 (/dev/rdisk/disk70)

# vxdisk list
DEVICE       TYPE            DISK         GROUP        STATUS
c2t0d0s2     auto:hpdisk     rootdisk02   rootdg       online
c2t1d0s2     auto:LVM        -            -            LVM
c3t2d0s2     auto:hpdisk     rootdisk01   rootdg       online
c5t0d1       auto:cdsdisk    rootdg02     rootdg       online
c5t0d2       auto:cdsdisk    rootdg03     rootdg       online
c5t0d3       auto:cdsdisk    rootdg04     rootdg       online
c5t0d4       auto:cdsdisk    rootdg05     rootdg       online
c5t0d5       auto:cdsdisk    rootdg06     rootdg       online
c5t0d6       auto:cdsdisk    rootdg07     rootdg       online
c5t0d7       auto:cdsdisk    rootdg08     rootdg       online
c5t1d0       auto:cdsdisk    rootdg01     rootdg       online

# vxdg free
GROUP        DISK         DEVICE       TAG          OFFSET    LENGTH    FLAGS
rootdg       rootdg01     c5t1d0       c5t1d0       0         4145024   -
rootdg       rootdg02     c5t0d1       c5t0d1       0         9387904   -
rootdg       rootdg03     c5t0d2       c5t0d2       0         4145024   -
rootdg       rootdg04     c5t0d3       c5t0d3       0         4145024   -
rootdg       rootdg05     c5t0d4       c5t0d4       0         4145024   -
rootdg       rootdg06     c5t0d5       c5t0d5       0         4145024   -
rootdg       rootdg07     c5t0d6       c5t0d6       0         4145024   -
rootdg       rootdg08     c5t0d7       c5t0d7       0         4145024   -
rootdg       rootdisk01   c3t2d0s2     c3t2d0s2     37322752  33440672  -
rootdg       rootdisk02   c2t0d0s2     c2t0d0s2     37322752  33440672  -

No comments:

Post a Comment