Menu Close

Chapter 7. Managing multipathed volumes

The following are a few commands provided by DM Multipath, which you can use to manage multipath volumes:

  • multipath
  • dmsetup
  • multipathd

7.1. Resizing an online multipath device

If you need to resize an online multipath device, use the following procedure.

Procedure

  1. Resize your physical device.
  2. Execute the following command to find the paths to the logical unit number (LUN):

    # multipath -l
  3. Resize your paths. For SCSI devices, writing a 1 to the rescan file for the device causes the SCSI driver to rescan, as in the following command:

    # echo 1 > /sys/block/path_device/device/rescan

    Ensure that you run this command for each of the path devices. For example, if your path devices are sda, sdb, sde, and sdf, you would run the following commands:

    # echo 1 > /sys/block/sda/device/rescan
    # echo 1 > /sys/block/sdb/device/rescan
    # echo 1 > /sys/block/sde/device/rescan
    # echo 1 > /sys/block/sdf/device/rescan
  4. Resize your multipath device:

    # multipathd resize map multipath_device
  5. Resize the file system (assuming no LVM or DOS partitions are used):

    # resize2fs /dev/mapper/mpatha

7.2. Moving a root file system from a single path device to a multipath device

If you have installed your system on a single-path device and later add another path to the root file system, you will need to move your root file system to a multipathed device. See the following procedure for moving from a single-path to a multipathed device.

Prerequisites

  • You have installed the device-mapper-multipath package.

Procedure

  1. Create the /etc/multipath.conf configuration file, load the multipath module, and enable the multipathd systemd service:

    # yum install device-mapper-multipath

Procedure

  1. Execute the following command to create the /etc/multipath.conf configuration file, load the multipath module, and set chkconfig for the multipathd to on:
  2. If the find_multipaths configuration parameter is not set to yes, edit the blacklist and blacklist_exceptions sections of the /etc/multipath.conf file, as described in Preventing devices from multipathing.
  3. In order for multipath to build a multipath device on top of the root device as soon as it is discovered, enter the following command. This command also ensures that find_multipaths allows the device, even if it only has one path.

    # multipath -a root_devname

    For example, if the root device is /dev/sdb, enter the following command.

    # multipath -a /dev/sdb
    wwid '3600d02300069c9ce09d41c4ac9c53200' added
  4. Confirm that your configuration file is set up correctly by executing the multipath command and search the output for a line of the following format. This indicates that the command failed to create the multipath device.

    date  wwid: ignoring map

    For example, if the WWID of the device is 3600d02300069c9ce09d41c4ac9c53200, you would see a line in the output such as the following:

    # multipath
    Oct 21 09:37:19 | 3600d02300069c9ce09d41c4ac9c53200: ignoring map
  5. Rebuild the initramfs file system with multipath:

    # dracut --force -H --add multipath
  6. Shut the machine down.
  7. Boot the machine.
  8. Make the other paths visible to the machine.

Verification steps

  • Check whether the multipath device is created by running the following command:

    # multipath -l | grep 3600d02300069c9ce09d41c4ac9c53200
    mpatha (3600d02300069c9ce09d41c4ac9c53200) dm-0 3PARdata,VV

7.3. Moving a swap file system from a single path device to a multipath device

By default, swap devices are set up as logical volumes. This does not require any special procedure for configuring them as multipath devices as long as you set up multipathing on the physical volumes that constitute the logical volume group. If your swap device is not an LVM volume, however, and it is mounted by device name, you might need to edit the /etc/fstab file to switch to the appropriate multipath device name.

Procedure

  1. Add the WWID of the device to the /etc/multipath/wwids file:

    # multipath -a swap_devname

    For example, if the root device is /dev/sdb, enter the following command.

    # multipath -a /dev/sdb
    wwid '3600d02300069c9ce09d41c4ac9c53200' added
  2. Confirm that your configuration file is set up correctly by executing the multipath command and search the output for a line of the following format:

    date  wwid: ignoring map

    This indicates that the command failed to create the multipath device.

    For example, if the WWID of the device is 3600d02300069c9ce09d41c4ac9c53200, you would see a line in the output such as the following:

    # multipath
    Oct 21 09:37:19 | 3600d02300069c9ce09d41c4ac9c53200: ignoring map
  3. Set up an alias for the swap device in the /etc/multipath.conf file:

    multipaths {
        multipath {
            wwid WWID_of_swap_device
            alias swapdev
        }
    }
  4. Edit the /etc/fstab file 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/fstab file:

    /dev/sdb2 swap                    swap    defaults        0 0

    Change the entry to the following:

    /dev/mapper/swapdev swap          swap    defaults        0 0
  5. Rebuild the initramfs file system with multipath:

    # dracut --force -H --add multipath
  6. Shut the machine down.
  7. Boot the machine.
  8. Make the other paths visible to the machine.

Verification steps

  • Verify if the the swap device is on the multipath device:

    # swapon -s

    For example:

    # swapon -s
    
    Filename                Type          Size Used    Priority
    /dev/dm-3               partition     4169724 0    -2

    The file name should match the multipath swap device.

    # readlink -f /dev/mapper/swapdev
    /dev/dm-3

7.4. Determining device mapper entries with the dmsetup command

You can use the dmsetup command to find out which device mapper entries match the multipathed devices.

Procedure

  • Display all the device mapper devices and their major and minor numbers. The minor numbers determine the name of the dm device. For example, a minor number of 3 corresponds to the multipathed device /dev/dm-3.

    # dmsetup ls
    mpathd  (253:4)
    mpathep1        (253:12)
    mpathfp1        (253:11)
    mpathb  (253:3)
    mpathgp1        (253:14)
    mpathhp1        (253:13)
    mpatha  (253:2)
    mpathh  (253:9)
    mpathg  (253:8)
    VolGroup00-LogVol01     (253:1)
    mpathf  (253:7)
    VolGroup00-LogVol00     (253:0)
    mpathe  (253:6)
    mpathbp1        (253:10)
    mpathd  (253:5)

7.5. Administering the multipathd daemon

The multipathd commands can be used to administer the multipathd daemon.

Procedure

  • View the standard default format for the output of the multipathd show maps command:

    # multipathd show maps
    name sysfs uuid
    mpathc dm-0 360a98000324669436c2b45666c567942
  • Some multipathd commands include a format option followed by a wildcard. Display a list of available wildcards with the following command:

    # multipathd show wildcards
  • Display the multipath devices that multipathd is monitoring, using a format string with multipath wildcards, in regular and raw format:

    list|show maps|multipaths format $format
    list|show maps|multipaths raw format $format

    The multipathd command supports format commands that show the status of multipath devices and paths in "raw" format versions. In raw format, no headers are printed and the fields are not padded to align the columns with the headers. Instead, the fields print exactly as specified in the format string. This output can then be more easily used for scripting. You can display the wildcards used in the format string with the multipathd show wildcards command.

  • Display the paths that multipathd is monitoring, using a format string with multipath wildcards, in regular and raw format:

    list|show paths format $format
    list|show paths raw format $format
  • Display the difference between the non-raw and raw formats for the multipathd show maps. Note that in raw format there are no headers and only a single space between the columns:

    # multipathd show maps format "%n %w %d %s"
    name   uuid                              sysfs vend/prod/rev
    mpathc 360a98000324669436c2b45666c567942 dm-0  NETAPP,LUN
    
    # multipathd show maps raw format "%n %w %d %s"
    mpathc 360a98000324669436c2b45666c567942 dm-0 NETAPP,LUN

Additional resources

  • multipathd(8) man page