To move the logical volume to a SCSI device:
This section explains how to change from an environment where HDLM devices are used as LVM physical volumes, to an environment where SCSI devices are used as LVM physical volumes.
This section provides the procedure for moving a logical volume on an HDLM device in a multipath configuration to a SCSI device in a single path configuration when using LVM2.
In Figure 1, sda1, sdb1, sdc1, and sdd1 indicate the same LU. Likewise, sda2, sdb2, sdc2, and sdd2 indicate the same LU. sddlmaa1 and sddlmaa2 indicate the HDLM devices corresponding to each LU.
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
If the LVM environment uses an HDLM device in a multi-path configuration, configure the path to an existing LU as a single path.
Change the path to an existing LU as a single-path configuration by performing the procedure described in DELETING_A_PATH_TO_AN_EXISTING_LU=GUID-18243AE2-FE6D-4FE2-BD33-1200C20A5203=2=EN=.html.
Edit the /etc/lvm/lvm.conf file.
Edit the device section in the file as shown below to enable the SCSI device configuration and disable the HDLM device configuration:
The following shows an example of editing the /etc/lvm/lvm.conf file. The underlined parts show the locations that were edited.
-
For Red Hat Enterprise Linux 9 or Oracle Linux 9 :
Before:
devices { : # global_filter = [ "a/.*/" ] 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 : }After:
devices { : # global_filter = [ "a/.*/" ] # global_filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/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 and types lines, and then add the underlined parts.
Comment out the lines where md_component_detection, multipath_component_detection, and use_devicesfile are set to 0 and the line where allow_changes_with_duplicate_pvs is set to 1.
Then, reset md_component_detection, allow_changes_with_duplicate_pvs, multipath_component_detection, and use_devicesfile to the original values by removing the comments from the lines that include the values that were set before the HDLM device configuration was enabled.
For Red Hat Enterprise Linux 8, Oracle Linux 8, Oracle Unbreakable Enterprise Kernel 8 or SUSE LINUX Enterprise Server 15 SP2 or later:
Before:
devices { : # global_filter = [ "a/.*/" ] 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 : }After:
devices { : # global_filter = [ "a/.*/" ] # global_filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] global_filter = [ "r|sddlm[a-p][a-p].*|", "a|/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 and types lines, and then add the underlined parts.
Comment out the line where md_component_detection is set to 0 and the line where allow_changes_with_duplicate_pvs is set to 1.
Then, reset md_component_detection and allow_changes_with_duplicate_pvs to the original values by removing the comments from the lines that include the values that were set before the HDLM device configuration was enabled.
Note that, in Red Hat Enterprise Linux 8.8 or later, Oracle Linux 8.8 or later, or SUSE LINUX Enterprise Server 15 SP5 or later, if the value of multipath_component_detection is set to 1, physical volumes are excluded during activation of the volume group in a multipath configuration. As a result, the volume group might not be successfully activated.
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:
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 = [ "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 : }After:
# This section allows you to configure which block devices should # be used by the LVM system. devices { : # filter = [ "a/.*/" ] # filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ] filter = [ "r|sddlm[a-p][a-p].*|", "a|/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 and types lines, and then add the underlined parts.
Return md_component_detection and write_cache_state to their original values by commenting out the lines md_component_detection = 0 and write_cache_state = 0 and then removing the comment marks from the lines containing the original values from before the HDLM device configuration was enabled.
Also, before enabling the HDLM device configuration, if you have changed the setting for allow_changes_with_duplicate_pvs, return it to the original value.
Note that if you set allow_changes_with_duplicate_pvs to 0, duplicate physical volumes might be detected when activating a volume group in a multipath configuration, and the volume group might not be activated.
-
Execute the vgscan command.
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
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.
The following shows an example of executing the pvscan command:
# pvscan PV /dev/sda1 VG vg01 lvm2 [468.00 MB / 368.00 MB free] PV /dev/sda2 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
If the /etc/fstab file was edited (a section was commented out) in step 5, return the commented out section to its original state.
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