6.3. Moving a swap file system from a single path device to a multipath device
Move swap file system from single-path to multipath storage to ensure redundancy and prevent performance issues. If swap uses LVM, no special steps are needed, but non-LVM swap devices may require editing /etc/fstab to use the correct multipath device name.
Procedure
Create the
/etc/multipath.confconfiguration file:# mpathconf --enableEnable the
multipathdservice:# systemctl enable multipathd.service-
If the
find_multipathsconfiguration parameter is not set toon, edit theblacklistandblacklist_exceptionssections of the/etc/multipath.conffile, as described in Preventing devices from multipathing. Add the WWID of the device to the
/etc/multipath/wwidsfile:# multipath -a /dev/sdb wwid '3600d02300069c9ce09d41c4ac9c53200' addedReplace /dev/sdb with the swap device name.
Confirm that your configuration file is set up correctly:
# multipath -d 3600d02300069c9ce09d41c4ac9c53200 : mpatha (3600d02300069c9ce09d41c4ac9c53200) undef 3PARdata,VV size=446M features='1 queue_if_no_path' hwhandler='1 alua' wp=undef `-+- policy='service-time 0' prio=50 status=undef `- 5:0:0:0 sdb 8:16 undef ready runningReplace 3600d02300069c9ce09d41c4ac9c53200 with the WWID of your swap device.
Set up an alias for the swap device in the
/etc/multipath.conffile:multipaths { multipath { wwid WWID_of_swap_device alias swapdev } }Edit the
/etc/fstabfile and replace the old device path to the root device with the multipath device.For example, if you had the following entry in the
/etc/fstabfile:/dev/sdb2 swap swap defaults 0 0Change the entry to the following:
/dev/mapper/swapdev swap swap defaults 0 0Rebuild the initramfs file system with multipath:
# dracut --force --add multipath- Shut the machine down.
- Boot the machine.
- Make the other paths visible to the machine.
Verification
Verify if the swap device is on the multipath device:
# swapon -s Filename Type Size Used Priority /dev/dm-3 partition 4169724 0 -2The file name should match the multipath swap device.
# readlink -f /dev/mapper/swapdev /dev/dm-3