Below the procedure to move logical volumes from any VG to another
Moving a JFS File System to a New Volume Group
This document describes how to move a journaled file system (JFS) from one volume group to another. Information in this document applies to AIX Versions 4x and 5x, but is NOT supported on JFS2.
ATTENTION: Make sure a full backup exists of any data you intend to migrate before using these procedures.
In AIX, storage allocation is performed at the volume group level. Storage cannot span volume groups. If space within a volume group becomes constrained, then space that is available in other volume groups cannot be used to resolve storage issues.
The solution to this problem is to add more physical volumes to the relevant volume group. This may not be an option in all environments. If other volume groups contain the required free space, the alternative is to move the required logical volumes to the desired volume group and expand them as needed.
The source logical volume can be moved to another volume group with the cplv command. The following steps achieve this.
ATTENTION: The logical volume should be inactive during these steps to prevent incomplete or inconsistent data. If the logical volume contains a mounted file system, then that file system should be unmounted first. If this logical volume is being used as a RAW storage device, then the application using this logical volume should close the device or be shut down.
1. Copy the source logical volume to the desired volume group with the cplv command. For example, where myvg is the new volume group and mylv is the name of the user's logical volume, enter:
# cplv -v myvg mylv
This will return the name of the new logical volume on the nw volume group, such as lv00. If this logical volume was being used for RAW storage, skip to step 6. If this is a JFS file system, proceed to step 2. Please note that RAW storage devices should NOT use the first 512 bytes of the RAW device. This is reserved for the LVCB or logical volume control block. cplv will not copy the first 512 bytes of the RAW logical volume, but it will update fields in the new logical volume's LVCB.
2. All JFS file systems require a log device. This will be a logical volume with a type of jfslog. Run the command lsvg -l on your destination volume group. If a JFS log DOES NOT already exist on the new volume group, create one by using the mklv and logform commands as detailed below. If a JFS log DOES exist, proceed to step 3. To make a new JFS log, enter the following command, where myvg is the name of the new volume group, enter:
# mklv -t jfslog myvg 1.
This will return a new JFS log logical volume such as loglv00. This will need to be formatted with the logform command to function as a JFS log. For example: logform /dev/loglv00. Answer yes to destroy.
3. Change the filesystem to reference a log device that exists in the new volume group and the new logical volume with the chfs command. For example, where myfilesystem is the name of the user's filesystem, enter:
# chfs -a dev=/dev/lv00 -a log=/dev/loglv00 /myfilesystem
Moving a JFS File System to a New Volume Group
This document describes how to move a journaled file system (JFS) from one volume group to another. Information in this document applies to AIX Versions 4x and 5x, but is NOT supported on JFS2.
ATTENTION: Make sure a full backup exists of any data you intend to migrate before using these procedures.
In AIX, storage allocation is performed at the volume group level. Storage cannot span volume groups. If space within a volume group becomes constrained, then space that is available in other volume groups cannot be used to resolve storage issues.
The solution to this problem is to add more physical volumes to the relevant volume group. This may not be an option in all environments. If other volume groups contain the required free space, the alternative is to move the required logical volumes to the desired volume group and expand them as needed.
The source logical volume can be moved to another volume group with the cplv command. The following steps achieve this.
ATTENTION: The logical volume should be inactive during these steps to prevent incomplete or inconsistent data. If the logical volume contains a mounted file system, then that file system should be unmounted first. If this logical volume is being used as a RAW storage device, then the application using this logical volume should close the device or be shut down.
1. Copy the source logical volume to the desired volume group with the cplv command. For example, where myvg is the new volume group and mylv is the name of the user's logical volume, enter:
# cplv -v myvg mylv
This will return the name of the new logical volume on the nw volume group, such as lv00. If this logical volume was being used for RAW storage, skip to step 6. If this is a JFS file system, proceed to step 2. Please note that RAW storage devices should NOT use the first 512 bytes of the RAW device. This is reserved for the LVCB or logical volume control block. cplv will not copy the first 512 bytes of the RAW logical volume, but it will update fields in the new logical volume's LVCB.
2. All JFS file systems require a log device. This will be a logical volume with a type of jfslog. Run the command lsvg -l on your destination volume group. If a JFS log DOES NOT already exist on the new volume group, create one by using the mklv and logform commands as detailed below. If a JFS log DOES exist, proceed to step 3. To make a new JFS log, enter the following command, where myvg is the name of the new volume group, enter:
# mklv -t jfslog myvg 1.
This will return a new JFS log logical volume such as loglv00. This will need to be formatted with the logform command to function as a JFS log. For example: logform /dev/loglv00. Answer yes to destroy.
3. Change the filesystem to reference a log device that exists in the new volume group and the new logical volume with the chfs command. For example, where myfilesystem is the name of the user's filesystem, enter:
# chfs -a dev=/dev/lv00 -a log=/dev/loglv00 /myfilesystem
4. Run fsck to ensure filesystem integrity. Enter:
# fsck -p /dev/lv00
5. Mount the file system. For example, where myfilesystem is the name of the user's file system, enter:
# mount /myfilesystem
At this point, the migration is complete, and any applications or users can now access the data in this filesystem. To change the logical volume name, proceed to the following step.
NOTE: If you receive errors from the preceding step, do not continue. Contact you AIX support center.
6. Remove the source logical volume with the rmlv command.
For example, where mylv is the name of the user's logical volume, enter:
# rmlv -f mylv
7. Rename and reset any needed attributes on the new logical volume with the chlv or chmod commands.
For example, where mylv is the name of the user's logical volume, enter:
# chlv -n mylv lv00
# fsck -p /dev/lv00
5. Mount the file system. For example, where myfilesystem is the name of the user's file system, enter:
# mount /myfilesystem
At this point, the migration is complete, and any applications or users can now access the data in this filesystem. To change the logical volume name, proceed to the following step.
NOTE: If you receive errors from the preceding step, do not continue. Contact you AIX support center.
6. Remove the source logical volume with the rmlv command.
For example, where mylv is the name of the user's logical volume, enter:
# rmlv -f mylv
7. Rename and reset any needed attributes on the new logical volume with the chlv or chmod commands.
For example, where mylv is the name of the user's logical volume, enter:
# chlv -n mylv lv00