vxcp_lvmroot - copy LVM root disk onto new Veritas Volume Manager root disk
/etc/vx/bin/vxcp_lvmroot [-g diskgroup] [-m mirror_root_da_name]
[-r rootvol_size] [-s standvol_size] [-S swapvol_size]
[-R percent] [-v] [-b] [-D] [-n] new_root_da_name
/etc/vx/bin/vxcp_lvmroot [-g diskgroup] [-m mirror_root_da_name]
[-r rootvol_size] [-s standvol_size] [-S swapvol_size]
[-v] [-b] [-D] new_root_da_name
The vxcp_lvmroot command copies (or "clones") the volumes associated with an LVM root volume group to volumes of equal size (unless the -R option is specified) on a VxVM root disk group.
VxVM rootability means that VxVM controls the disk containing the root file system. The vxcp_lvmroot command provides a means of achieving VxVM rootability when upgrading from a prior release of HP-UX without having to use Ignite_UX to perform a cold install.
In the first form of the command shown in the SYNOPSIS, the single specified disk is initialized as a VxVM disk, and the volumes in a single physical volume LVM root volume group are copied to that disk.
The second form of the vxcp_lvmroot command copies a multiple disk LVM root volume group. This form of the command also supports striped volumes. The -p option is used to specify a list of additional disks that are required to copy a multiple disk LVM root volume group. Before commencing copying, vxcp_lvmroot determines the number of disks that are required. If insufficient disks are specified, vxcp_lvmroot displays how many disks are needed, and then exits with an error.
vxcp_lvmroot performs the following additional checks on the specified disks:
Once all the checks are satisfied, the new disks are given VxVM disk media (DM) names. The root disks (that is, the disk or disks containing the root file system), are given names of the form rootdisk##, and other disks are named rootaux##. Here ## is a number starting at 01 that creates a unique disk name.
If VxVM has not yet been enabled using vxinstall, vxcp_lvmroot enables it before initializing the new disks for VxVM use.
Volumes named rootvol, swapvol and dumpvol are generated to correspond to the root, swap and dump (if any) volumes. The names of other volumes on the new root disk are generated by concatenating the name of the mount point below / with vol (for example, usrvol would be the volume that corresponds to /usr).
When the VxVM root disk volumes have been made, the data from each LVM volume is copied to the equivalent VxVM volume. For volumes containing file systems, the copy is performed using the cpio command. For volumes that do not contain file systems, the data is copied using the dd command. An exception to this rule is the swap volume, which has 256KB of random data written to it to make it consistent. Note: To distinguish this action from copying, it is termed "cloning" in the verbose message output.
To minimize disk arm movement, volume copies are performed serially in the foreground. To ensure that no data corruption has occurred during copying, the fsck command is run on each freshly populated file system.
After all of the volumes have been copied, the vxbootsetup command is run on the new root disk to set it up as a bootable VxVM disk under HP-UX. Once this is complete, the root and stand file systems on the new disk are temporarily mounted, and the following files updated to reflect the new environment:
After successfully configuring the new VxVM root disk configuration, vxcp_lvmroot runs the setboot command to specify the disk, new_root_da_name, as the primary boot device in NVRAM before exiting.
Invokes the setboot(1M) command to change the primary and alternate boot device settings. The primary boot device is set to the newly cloned VxVM root device. If the -m option is also specified, the alternate boot device is set to the root mirror. If the -m option is not specified, the alternate boot device is set to the LVM root from which the VxVM root was cloned. If the -v is also specified, information on the settings for the primary and alternate boot devices is displayed.
Uses the vxdump(1M) and vxrestore(1M) commands to copy VxFS file systems, and the dump(1M) and restore(1M) commands to copy HFS file systems.
The default method of copying file systems is to use the find(1M) and cpio(1M) commands. However, if one or more of the file systems to be copied contain files with "holes" (that is, files that appear to be very large, but which are sparse and contain very little storage), this may exceed the capability of the target file system to copy the files using find and cpio. One symptom of this condition is to receive a "file system full" indication on the target file system while copying. (Whereas the find and cpio commands assume that a file's size correctly represents the storage required, the vxdump, vxrestore, dump and restore commands copy a sparse file as it appears in the source file system.)
If a "file system full" condition is indicated for one of the target file systems, start vxcp_lvmroot again with the -D option specified.
Note the vxdump, vxrestore, dump and restore commands are not well suited for running from a shell script. If you interrupt the script (for example, by pressing Ctrl-C), these commands prompt you to ask whether you really want to continue or abort. The output from the dump commands is verbose and so is redirected to a file. As this redirection would hide any continue/abort prompt, and make the program appear to hang, the interrupt signal is temporarily disabled while the copy is in progress (a message to this effect is displayed if the -v option is specified).
Specifies the boot disk group.
Creates a mirrored root disk using the specified device name (disk access name) of a physical disk. This disk must have the same attributes as the disk specified by new_root_da_name.
Any LVM volumes that are spanned or striped across multiple Physical Volumes (that is, separate disks) are copied onto the single specified output disk.
Note There must be adequate space on the output disk for all of the spanned or striped LVM volumes.
The -n option is mutually exclusive with the -p option,
Specifies a list of disks that are to be used to satisfy requirements for extra disks when copying multiple disk LVM root volume groups. Disks specified in this pool are used for copying contiguous volumes that do not reside on the root disk, as well as for copying stripe columns when striped volumes exist in the LVM root volume group. If the -m option is specified, any mirrors of the volumes are directed to disks from this pool.
The disks are specified as a comma-separated list of device names (disk access names). These disks are checked for existence, correct size, and availability for use.
The -p option is mutually exclusive with the -n option.
Permits the volume containing the root file system, which is required to be contiguous, to be created with the specified size in megabytes on the target disk. The root file system is also created with this size. If the specified size is smaller than the current LVM root volume, checks are made to ensure that the current root file system is not using more space than the specified size. If the specified size is larger than the current LVM root volume, checks are made to ensure that the new root volume can fit on the target root disk.
The -r option is mutually exclusive with the -R option.
Reduces the space requirements of the target disk by the specified percentage.
If the target disk has less space than the original LVM root disk, it is not possible to create VxVM volumes with the same size as the original LVM volumes. This option takes advantage of the fact that most file systems are nowhere near full. Each file system on the source disk is checked for space usage and the target volume size is reduced by the specified percentage if the resulting file system would not be more than 80% full.
Note Only volumes containing file systems are reduced in size.
The minimum and maximum values for the percentage size reduction, percent, that may be specified are 10 and 60 respectively.
The -R option is mutually exclusive with the -r, -s and -S options.
Permits the volume containing the stand file system, which is required to be contiguous, to be created with the specified size in megabytes on the target disk. The stand file system is also created with this size. If the specified size is smaller than the current LVM stand volume, checks are made to ensure that the current stand file system is not using more space than the specified size. If the specified size is larger than the current LVM stand volume, checks are made to ensure that the new stand volume can fit on the target root disk.
The -s option is mutually exclusive with the -R option.
Permits the initial swap volume, which is required to be contiguous, to be created with the specified size in megabytes on the target disk. If the specified size represents an increase in size, checks are made to ensure that the new initial swap volume can fit on the target root disk.
The -S option is mutually exclusive with the -R option.
Outputs verbose messages including a timestamp that indicates major operations being performed. Since copying the data on a root disk can take a considerable amount of time, this gives an indication of the progress being made.
Specifies the device name (disk access name) of the physical disk that is to become the VxVM root disk.
This example shows the vxcp_lvmroot command invoked in its simpliest form:
The next example also creates a root mirror on disk c6t1d0:
/etc/vx/bin/vxcp_lvmroot -m c6t1d0 c5t1d0
The -R option may be used to reduce the size of volumes containing file systems on the target disk by a specified percentage. The next example specified a size reduction of 30%. The -v option is also specified to provide a verbose listing of the changes made to the file system sizes (edited here for clarity):
# /etc/vx/bin/vxcp_lvmroot -v -b -R 30 c5t1d0
Gathering information on the current VxVM root configuration
Checking specified disk(s) for usability
Preparing disk c5t1d0 as a VxVM disk
Adding disk c5t1d0 to rootdg as DM rootdisk01
Copying /dev/vg01/lvol1 (hfs) to /dev/vx/dsk/rootdg/standvol
standvol size of 323 MB, reduced from lvol1 size of 512
Cloning /dev/vg01/lvol2 (swap) to /dev/vx/dsk/rootdg/swapvol
Copying /dev/vg01/lvol3 (vxfs) to /dev/vx/dsk/rootdg/rootvol
rootvol size of 352 MB, reduced from lvol3 size of 512
Copying /dev/vg01/lvol4 (vxfs) to /dev/vx/dsk/rootdg/homevol
homevol size of 347 MB, reduced from lvol4 size of 512
Copying /dev/vg01/lvol5 (vxfs) to /dev/vx/dsk/rootdg/optvol
optvol size of 1391 MB, reduced from lvol5 size of 2048
Copying /dev/vg01/lvol6 (vxfs) to /dev/vx/dsk/rootdg/tmpvol
tmpvol size of 173 MB, reduced from lvol6 size of 256
Copying /dev/vg01/lvol7 (vxfs) to /dev/vx/dsk/rootdg/usrvol
Copying /dev/vg01/lvol8 (vxfs) to /dev/vx/dsk/rootdg/varvol
varvol size of 2788 MB, reduced from lvol8 size of 4096
Setting up disk c5t1d0 as a boot disk
Installing fstab and fixing dev nodes on new root FS
vxcp_lvmroot 18:03: Current setboot values:
vxcp_lvmroot 18:03: Primary: 0/4/0/0.13.0
vxcp_lvmroot 18:03: Alternate: 0/0/6/0/0.0.0
Making c5t1d0 (0/4/0/0.1.0) the primary boot disk
Making c5t13d0 (0/4/0/0.13.0) the alternate boot disk
Disk c5t1d0 is now a VxVM rootable boot disk
The following example shows how to specify a disk pool to copy volumes from an LVM root disk that contains multiple disk contiguous volumes, including striped volumes, across 4 column stripes:
vxcp_lvmroot -v -p c5t5d0,c5t8d0,c5t9d0 c5t4d0
The next example demonstrates how to copy and mirror an LVM root disk that has 4 column stripes:
vxcp_lvmroot -v -p c5t5d0,c5t8d0,c5t9d0,ct11d0,c5t12d0,c5t13d0 \
-m c5t10d0 c5t4d0
The use of the -v (verbose) option is encouraged. Copying the data from the LVM root volume group to VxVM volumes is a lengthy operation. The -v option indicates progress of the operation as each volume is being copied. If the -v option is not specified, the vxcp_lvmroot command is silent for the duration of the volume copy operation, which usually takes more than 30 minutes.
If the vxcp_lvmroot command aborts for any reason, or if you interrupt the command during execution (unless this is inhibited by the -D option), an attempt is made to clean up the VxVM objects that had been generated up to the time of the abort or interruption. All volumes that had already been copied, or that were in the process of being copied when the interruption occurred, are removed. All Data Media (DM) objects that were created are also removed. If a volume or a DM object cannot be removed, an explanatory message is displayed.
cpio(1), dd(1), dump(1M), fsck(1M), restore(1M), setboot(1M), vxbootsetup(1M), vxdump(1M), vxrestore(1M)