Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

5.3. Moving root File Systems 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. This section documents the procedure for moving from a single-path to a multipathed device.
After ensuring that you have installed the device-mapper-multipath package, perform the following 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:
    # mpathconf --enable
    For further information on using the mpathconf command to set up multipathing, see Section 3.1, “Setting Up DM-Multipath”.
  2. Edit the blacklist and blacklist_exceptions sections of the /etc/multipath.conf file, as described in Section 4.2, “Configuration File Blacklist”.
  3. To confirm that your configuration file is set up correctly, you can run the /sbin/multipath command with the -v3 option to check whether the multipath daemon tried to create a multipath device over your root device. The command will fail since the root the device is in use, but the output from the command should show the root device in the paths list.
    You should look in the command output for a line of the following format:
    WWID  H:B:T:L devname MAJOR:MINOR
    For example, if your root file system is set up on sda or one of its partitions, you would see a line in the output such as the following:
    ===== paths list =====
    ...
    1ATA     WDC WD800JD-75MSA3                           WD-WMAM9F 1:0:0:0 sda 8:0
    ...
    
    Later in the output, you should see the root device assigned to a multipath device:
    time | devname: ownership set to mpathdev
    
    For example, the output may appear as follows:
    Jun 14 06:48:21 | sda: ownership set to mpatha
    
    You will also see an indication that the command failed to create the multipath device with a line of the following format:
    time | mpathdev: domap (0) failure for create/reload map
    
    In the example noted above, you would see the following line in the command output:
    Jun 14 06:48:21 | mpatha: domap (0) failure for create/reload map
    
  4. To rebuild the initramfs file system with multipath, execute the dracut command with the following options:
    # dracut --force --add multipath --include /etc/multipath /etc/multipath
  5. If your root device is not an LVM volume and it is mounted by device name, you may need to edit the fstab file to switch to the appropriate multipath device name. If your root device is an LVM device or is mounted by UUID or something else, this step is not necessary.
    1. Use the procedure described in Step 3 of running the /sbin/multipath command with the -v3 to determine the WWID of the root device.
    2. Set up an alias for the root device in the /etc/multipath.conf file:
      multipaths {
          multipath {
              wwid WWID_of_root_device
              alias rootdev
          }
      }
      
    3. Edit the /etc/fstab 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/sda1 /                       ext4    defaults        1 1
      
      You would change the entry to the following:
      /dev/mapper/rootdev /             ext4    defaults        1 1
      
    If you need to edit the /etc/fstab file, you will also need to edit the /etc/grub.conf file and change the root parameter from root=/dev/sda1 to root=/dev/mapper/rootdev.
    The following example shows what this grub.conf file entry would look like before you edit it.
    title Red Hat Enterprise Linux FoundationServer (2.6.32-71.24.1.el6.x86_64)
            root (hd0,0)
            kernel /vmlinuz-2.6.32-71.24.1.el6.x86_64 ro root=/dev/sda1 rd_NO_LUKS
    rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us
    console=ttyS0,115200n8 crashkernel=auto
            initrd /initramfs-2.6.32-71.24.1.el6.x86_64.img
    
    The following example shows what the grub.conf file entry would look like after you edit it.
    title Red Hat Enterprise Linux FoundationServer (2.6.32-71.24.1.el6.x86_64)
            root (hd0,0)
            kernel /vmlinuz-2.6.32-71.24.1.el6.x86_64 ro root=/dev/mapper/rootdev
    rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16
    KEYTABLE=us console=ttyS0,115200n8 crashkernel=auto
            initrd /initramfs-2.6.32-71.24.1.el6.x86_64.img
    
  6. Shut the machine down.
  7. Configure the FC switch so that other paths are visible to the machine.
  8. Boot the machine.
  9. Check whether the root file system ('/') is on the multipathed device.