To move the logical volume to an HDLM device:
This subsection explains the procedure for moving a logical volume created on a SCSI device in a single-path environment to an HDLM device in a multi-path environment. Use the following procedure to configure the environment in Figure 1.
In Figure 1, sdn indicates the different LUs. sddlmad1 and sddlmad2 indicate the HDLM devices corresponding to each LU.
Make sure that HDLM has been installed.
Execute the rpm command to make sure that HDLM has been installed.
# rpm -q HDLM HDLM-x.x.x.x.xxx-x
Make sure that the path is a single path.
Execute the HDLM-configuration definition utility (dlmcfgmgr) with the -v parameter specified to make sure that the path to the LU is a single path.
# dlmcfgmgr -v HDevName Management Device Host Channel Target Lun /dev/sddlmaa configured /dev/sda 2 0 0 0 /dev/sddlmab configured /dev/sdb 2 0 0 1 KAPL10302-I /sbin/dlmcfgmgr completed normally.
Stop all processes and services that are using the SCSI and HDLM devices.
Unmount the logical volume to be moved.
In the following example, the logical volume subject to the move has been mounted on /mnt/lvol1:
# umount /mnt/lvol1
Deactivate the volume group.
In the following example, the logical volume to be moved belongs to the vg01 volume group:
# vgchange -an vg01 0 logical volume(s) in volume group "vg01" now active
Export the volume group.
In the following example, the command exports information about the vg01 volume group:
# vgexport vg01 Volume group "vg01" successfully exported
Edit the /etc/lvm/lvm.conf file.
Edit the device section in the file as shown below to disable the SCSI device configuration and enable the HDLM device configuration:
The following shows an example of editing the /etc/lvm/lvm.conf file.
-
For Red Hat Enterprise Linux 9 or Oracle Linux 9:
Before:
devices { : # global_filter = [ "a/.*/" ] global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] : # types = [ "fd", 16 ] : md_component_detection = 1 : allow_changes_with_duplicate_pvs = 0 : multipath_component_detection=1 : use_devicesfile=1 : }After:
devices { : # global_filter = [ "a/.*/" ] # global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] global_filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] : # types = [ "fd", 16 ] types = [ "sddlmfdrv", 16 ] : # md_component_detection = 1 md_component_detection=0 : # allow_changes_with_duplicate_pvs = 0 allow_changes_with_duplicate_pvs = 1 : # multipath_component_detection=1 multipath_component_detection=0 : # use_devicesfile=1 use_devicesfile=0 : }Comment out the existing global_filter, types, md_component_detection, allow_changes_with_duplicate_pvs, multipath_component_detection, and use_devicesfile lines, and then add the underlined parts.
Record the original values, because they are necessary when restoring the SCSI device configuration.
For Red Hat Enterprise Linux 8, Oracle Linux 8, Oracle Unbreakable Enterprise Kernel 8 or SUSE LINUX Enterprise Server 15 SP2 or later:
For Red Hat Enterprise Linux 8.8 or later, Oracle Linux 8.8 or later, or SUSE LINUX Enterprise Server 15 SP5 or later, set the value of multipath_component_detection to 0. For details, see NOTES_ON_USING_LVM2=GUID-91F95B7F-B4F1-4A73-A110-536AD5C219CC=5=EN=.html#GUID-91F95B7F-B4F1-4A73-A110-536AD5C219CC .
Before:
devices { : # global_filter = [ "a/.*/" ] global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] : # types = [ "fd", 16 ] : md_component_detection = 1 : allow_changes_with_duplicate_pvs = 0 : }After:
devices { : # global_filter = [ "a/.*/" ] # global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] global_filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] : # types = [ "fd", 16 ] types = [ "sddlmfdrv", 16 ] : # md_component_detection = 1 md_component_detection=0 : # allow_changes_with_duplicate_pvs = 0 allow_changes_with_duplicate_pvs = 1 : }Comment out the existing global_filter, types, md_component_detection and allow_changes_with_duplicate_pvs lines, and then add the underlined parts.
Record the original values, because they are necessary when restoring the SCSI device configuration.
For SUSE LINUX Enterprise Server 12, SUSE LINUX Enterprise Server 15 SP1 or earlier, Red Hat Enterprise Linux 7, Oracle Linux 7 or Oracle Unbreakable Enterprise Kernel 7:
Specify 1 for allow_changes_with_duplicate_pvs and 0 for write_cache_state. For details, see NOTES_ON_USING_LVM2=GUID-91F95B7F-B4F1-4A73-A110-536AD5C219CC=5=EN=.html.
If you want to use use_lvmetad=0 for operation, specify filter, not global_filter.
Before:
# This section allows you to configure which block devices should # be used by the LVM system. devices { : # filter = [ "a/.*/" ] filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] : write_cache_state = 1 : # types = [ "fd", 16 ] : md_component_detection = 1 : }After:
# This section allows you to configure which block devices should # be used by the LVM system. devices { : # filter = [ "a/.*/" ] # filter = [ "r|sddlm[a-p][a-p].*|", "a|/dev/sd|" ] filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] : # write_cache_state = 1 write_cache_state = 0 : # types = [ "fd", 16 ] types = [ "sddlmfdrv", 16 ] : # md_component_detection = 1 md_component_detection=0 : }Comment out the existing filter, write_cache_state, types and md_component_detection lines, and then add the underlined parts.
Record the original values, because they are necessary when restoring the SCSI device configuration.
-
Execute the VG scan.
To re-create the volume group on the HDLM device, execute the vgscan command as shown in the following example:
# vgscan Reading all physical volumes. This may take a while... Found exported volume group "vg01" using metadata type lvm2
Delete the LVM cache files.
If the following files exist, delete them:
/etc/lvm/.cache
/etc/lvm/cache/.cache
Import the volume group.
In the following example, the command imports the vg01 volume group:
# vgimport vg01 Volume group "vg01" successfully imported
Execute the pvscan command to check that the environment has been changed successfully.
Execute the following command to make sure that the information about the physical volume for the target logical volume has been changed to the information about the HDLM device:
# pvscan PV /dev/sddlmad1 VG vg01 lvm2 [468.00 MB / 368.00 MB free] PV /dev/sddlmad2 VG vg01 lvm2 [548.00 MB / 548.00 MB free] Total: 2 [1016.00 MB] / in use: 2 [1016.00 MB] / in no VG: 0 [0 ]
Activate the volume group.
In the following example, the logical volume subject to the move belongs to the vg01 volume group:
# vgchange -ay vg01 1 logical volume(s) in volume group "vg01" now active
Add a path to the LU.
Add a path to an existing LU by carrying out the procedure described in ADDING_A_PATH_TO_AN_EXISTING_LU=GUID-0186202E-6E0A-4D7B-A4E7-60B251D32C7B=2=EN=.html.
Mount the logical volume that was moved.
In the following example, the logical volume that was moved is /dev/vg01/lvol1 and the command mounts the volume on /mnt/lvol1:
# mount /dev/vg01/lvol1 /mnt/lvol1