recreatevg Command

Purpose

Re-creates a volume group that exists on a specified set of disks. Imports and varies on the volume group.

Syntax

recreatevg [-y VGname] [ -p ] [ -f ] [ -YLv_Prefix | -l LvNameFile] [ -L Label_Prefix] [ -n ] [-V MajorNumber ] [ -d ] [ -O ] PVname...

Description

The recreatevg command re-creates a volume group on a set of disks that are duplicated from another set of disks that belong to a specific volume group. This command overcomes the problem of duplicated Logical Volume Manager (LVM) data structures and identifiers that are caused by a disk duplication process. This command allocates new physical volume identifiers (PVID) for the member disks, as the PVIDs are also duplicated by the disk duplication. Similarly, duplicated logical volume members are given new names with the user-specified prefixes.

  1. The recreatevg command removes all logical volumes that fully or partially exist on the physical volumes that are not specified on the command line. Mirrored logical volumes can be an exception (see the -f flag).
  2. The recreatevg command warns, if the log for the logical volume of a file system does not exist on the disks that are specified on the command line.
  3. The recreatevg command fails, if the input list does not match the list that is compiled from the Volume Group Descriptor Area (VGDA).
  4. The set of disks in the list must have consistent VGDA data. The recreatevg command does not fix VGDA problems.
  5. When re-creating a concurrent-capable volume group, the volume group is not varied on when the recreatevg command completes. The new volume group must be varied on manually.

Flags

Item Description
-d Instead of completely re-creating the VG, the d flag causes the recreatevg command to create only new PVIDs for the specified disks and update the LVM metadata with the new PVIDs. Logical volumes (LVs) names and labels is not changed and the VG is not imported. This flag is incompatible with other flags except the -O flag.
-f Re-creates a volume group (VG) from a subset of disks. Only those disks and the logical volumes (LVs) that is present entirely on this subset of disks is present in the re-created VG. All other disks and LVs from the original VG is deleted in the re-created VG.

For mirrored LVs, only LV mirror copies with physical partitions allocated on the deleted disks are removed. Therefore, a mirrored LV can be re-created with fewer mirror copies when one of copies is present on the subset of disks.

-lLvNameFile Changes logical volume names to the name specified by LvNameFile. Entries must be in the format LV:NEWLV1. All logical volumes that are not included in LvNameFile are re-created with default system generated names. NEWLV1 name can be the same as LV name in the LvNameFile stanza (LV:NEWLV1) to leave the logical volume with the same name.
-LLabel_Prefix Changes the labels of logical volumes on the VG being re-created to this prefix. You must modify the /etc/filesystems filepath manually if a simple modification of the mount point is not enough to define the stanza uniquely. Specifying / (slash) as the Label_Prefix, leaves the label in the logical volume unchanged.
-n Specifies that after recreatevg the volume group is imported but varied off. Default is imported and varies on.
-p Disables the automatic generation of the new PVIDs. If the -p flag is used, you must ensure that there are no duplicated PVIDs on the system. All the disks that are hardware that is mirrored must have their PVIDs changed to a unique value.
-O Forces the volume group to be re-created and varied on even if the metadata on the disk indicates that this volume group is varied on in another node. See the varyonvg command for detailed information.
-VMajorNumber Allows the major number of the volume group to be specified rather than having the major number generated automatically.
-y VGname Allows the volume group name to be specified rather than having the name generated automatically. Volume group names must be unique system wide and can range from 1 to 15 characters. The name cannot begin with a prefix already defined in the PdDv class in the Device Configuration database for other devices. The new volume group name is sent to standard output.
-Y Lv_Prefix Causes the logical volumes on the volume group that is being re-created to be renamed with this prefix. The total length of the prefix and the logical volume name must be less than or equal to 15 characters. If the length exceeds 15 characters, the logical volume is renamed with a default name. The default name must comply to the following conditions:
  • Cannot begin with a prefix that is already defined in the PdDv class of the Device Configuration database.
  • Cannot use a name that is already used by another system.
Specifying NA as the Lv_Prefix, leaves all the logical volume names unchanged.

Security

Access Control: You must have root authority to run this command.

Examples

  1. To re-create a volume group that contains three physical volumes, enter the command:
    recreatevg hdisk1 hdisk2 hdisk3
    The volume group on hdisk1, hdisk2, and hdisk3 is re-created with an automatically generated name, which is displayed.
  2. To re-create a volume group on hdisk1 with the new name testvg, enter the command:
    recreatevg -y testvg hdisk1
  3. To re-create a volume group on hdisk14, re-create all logical volumes in that volume group, and rename them with the prefix newlv, enter the command:
    recreatevg -Y newlv hdisk14

Files

Item Description
/usr/sbin   Directory where the recreatevg command is present.