3.25.8 LVM2の設定解除
HDLMデバイスでLVMの物理ボリュームを使用する環境から,SCSIデバイスでLVMの物理ボリュームを使用する環境に移行する手順を説明します。
ここでは,LVM2の環境で,マルチパス環境のHDLMデバイス上にある論理ボリュームを,シングルパス環境のSCSIデバイス上に移行する場合の手順について説明します。
「図3‒19 HDLMデバイス上にある論理ボリュームをSCSIデバイス上に移行する場合のデバイス構成」に示す環境を作成するには,次の手順で行ってください。HDLMをアンインストールするときは,この手順をアンインストールの前に実施してください。
「図3‒19 HDLMデバイス上にある論理ボリュームをSCSIデバイス上に移行する場合のデバイス構成」のsda1,sdb1,sdc1,sdd1は同じLUを示します。また,sda2,sdb2,sdc2,sdd2も同じLUを示します。sddlmaa1とsddlmaa2はそれぞれのLUに対応するHDLMデバイスを示します。
SCSIデバイス,およびHDLMデバイスを使用しているプロセス,サービスなどをすべて停止します。
移行対象の論理ボリュームをアンマウントします。
論理ボリュームが/mnt/lvol1にマウントされている場合の実行例を次に示します。
# umount /mnt/lvol1
ボリュームグループを非活性化します。
移行対象の論理ボリュームが,vg01(ボリュームグループ)に属している場合の実行例を次に示します。
# vgchange -an vg01 0 logical volume(s) in volume group "vg01" now active
ボリュームグループをエクスポートします。
vg01(ボリュームグループ)の情報をエクスポートする場合の実行例を次に示します。
# vgexport vg01 Volume group "vg01" successfully exported
マルチパス構成でHDLMデバイスを使用したLVM環境である場合は,既存LUへのパスをシングルパス構成にします。
「4.7.4 HDLMデバイスの構成変更」の「(5) LUへのパスを削除する」を参照して,既存LUへのパスをシングルパス構成にしてください。
- 注意事項
再起動を行う場合,/etc/fstabファイルに操作対象の論理ボリュームをマウントする記述があるときは,その記述をコメントアウトしてください。また,操作対象の論理ボリュームにアクセスするアプリケーションを停止してください。
/etc/lvm/lvm.confファイルを編集します。
SCSIデバイスの構成を有効にしてHDLMデバイスの構成を無効にするために,ファイル中のデバイスセクションに対して次の編集を行います。
/etc/lvm/lvm.confファイルの編集例を次に示します。下線部が編集個所です。
-
Red Hat Enterprise Linux 9の場合
変更前
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 : }
変更後
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 : }
既存のglobal_filterおよびtypesの行をコメントアウトし,下線部を追加します。
md_component_detection,multipath_component_detection,use_devicesfileは0に設定した行をコメントアウトし,allow_changes_with_duplicate_pvsは1に設定した行をコメントアウトします。
そのあと,md_component_detection,allow_changes_with_duplicate_pvs,multipath_component_detection,use_devicesfileはHDLMのデバイスの構成を有効にする前の値を設定している行のコメントを解除して,元に戻します。
Red Hat Enterprise Linux 8,Oracle Linux 8,Oracle Unbreakable Enterprise Kernel 8またはSUSE LINUX Enterprise Server 15 SP2以降の場合
変更前
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 : }
変更後
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 : }
既存のglobal_filterおよびtypesの行をコメントアウトし,下線部を追加します。
md_component_detectionは0に設定した行をコメントアウトし,allow_changes_with_duplicate_pvsは1に設定した行をコメントアウトします。
そのあと,md_component_detection,allow_changes_with_duplicate_pvsはHDLMのデバイスの構成を有効にする前の値を設定している行のコメントを解除して,元に戻します。
なお,Red Hat Enterprise Linux 8.8以降の場合で,multipath_component_detectionの設定を1にしたときは,マルチパス構成ではボリュームグループを活性化する際に物理ボリュームが除外され,ボリュームグループを活性化することができていないことがあるので注意してください。
SUSE LINUX Enterprise Server 12,SUSE LINUX Enterprise Server 15 SP1以前,Red Hat Enterprise Linux 7,Oracle Linux 7およびOracle Unbreakable Enterprise Kernel 7の場合
use_lvmetad=0で運用する場合は,global_filterではなくfilterで指定してください。
変更前
# 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 : }
変更後
# 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 : }
既存のfilterおよびtypesの行をコメントアウトし,下線部を追加します。
md_component_detectionおよびwrite_cache_stateは0に設定した行をコメントアウトし,HDLMのデバイスの構成を有効にする前の値を設定している行のコメントを解除して,元に戻します。
また,HDLMデバイスの構成を有効にする前に,allow_changes_with_duplicate_pvsの設定を変更している場合は,元の値に戻してください。
なお,allow_changes_with_duplicate_pvsの設定を0にした場合は,マルチパス構成ではボリュームグループを活性化する際に,物理ボリュームの重複が検知され,ボリュームグループを活性化することができていないことがあるので注意してください。
上記以外のOSの場合
global_filterが使用できるLVM2のバージョンで,use_lvmetad=1で運用する場合は,filterではなくglobal_filterで指定してください。
変更前
# This section allows you to configure which block devices should # be used by the LVM system. devices { : # filter = [ "a/.*/" ] : # global_filter = [ "a/.*/" ] global_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 : }
変更後
# This section allows you to configure which block devices should # be used by the LVM system. devices { : # filter = [ "a/.*/" ] : # 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|" ] : write_cache_state = 1 # write_cache_state = 0 : # types = [ "fd", 16 ] # types = [ "sddlmfdrv", 16 ] : md_component_detection = 1 # md_component_detection=0 : }
既存のglobal_filterおよびtypesの行をコメントアウトし,下線部を追加します。
md_component_detectionおよびwrite_cache_stateは0に設定した行をコメントアウトし,HDLMのデバイスの構成を有効にする前の値を設定している行のコメントを解除して,元に戻します。
HDLMをアンインストールする場合は,次の操作を行ってください。
Red Hat Enterprise Linux 8,Red Hat Enterprise Linux 9,Oracle Linux 8,Oracle Unbreakable Enterprise Kernel 8またはSUSE LINUX Enterprise Server 15 SP2以降の場合
global_filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ]およびtypes = [ "sddlmfdrv", 16 ]を削除します。
global_filterエントリーのコメントを解除して,HDLMのデバイスの構成を有効にする前の状態に戻してください。
上記以外のOSの場合
filter = [ "a|sddlm[a-p][a-p].*|", "r|/dev/sd|" ],write_cache_state = 0およびtypes = [ "sddlmfdrv", 16 ]を削除します。
filterエントリーのコメントを解除して,HDLMのデバイスの構成を有効にする前の状態に戻してください。
-
VGスキャンを実行します。
HDLMデバイスでボリュームグループを再構築するために,vgscanコマンドを実行します。実行例を次に示します。
# vgscan Reading all physical volumes. This may take a while... Found exported volume group "vg01" using metadata type lvm2
ボリュームグループをインポートします。
vg01(ボリュームグループ)の情報をインポートする場合の実行例を次に示します。
# vgimport vg01 Volume group "vg01" successfully imported
移行が正常に終了したかどうかをpvscanコマンドを実行して確認します。
pvscanコマンドの実行例を次に示します。
# 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 ]
ボリュームグループを活性化します。
移行対象の論理ボリュームが,vg01(ボリュームグループ)に属している場合の実行例を次に示します。
# vgchange -ay vg01 1 logical volume(s) in volume group "vg01" now active
手順5で/etc/fstabファイルを編集した場合は,該当する行のコメントアウトを解除します。
移行対象の論理ボリュームをマウントします。
移行対象の論理ボリュームが/dev/vg01/lvol1で,これを/mnt/lvol1にマウントする場合の実行例を次に示します。
# mount /dev/vg01/lvol1 /mnt/lvol1