Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Managing multipathed volumes
You can manage multipath volumes by using the multipath
, dmsetup
, and multipathd
commands, which are provided by DM Multipath.
6.1. Resizing an online multipath device Copia collegamentoCollegamento copiato negli appunti!
You can resize an online multipath device and a file system by using the multipad
and resize2fs
commands .
Procedure
- Resize your physical device.
Find the paths to the logical unit number (LUN):
multipath -l
# multipath -l
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
# echo 1 > /sys/block/path_device/device/rescan
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that you run this command for each of the path devices. For example, if your path devices are
sda
,sdb
,sde
, andsdf
, 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
# 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
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Resize your multipath device:
multipathd resize map multipath_device
# multipathd resize map multipath_device
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Resize the file system, assuming no LVM or DOS partitions are used:
resize2fs /dev/mapper/mpatha
# resize2fs /dev/mapper/mpatha
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2. Moving a root file system from a single path device to a multipath device Copia collegamentoCollegamento copiato negli appunti!
If you have installed your system on a single-path device and later added another path to the root file system, move your root file system to a multipathed device.
Prerequisites
-
You have installed the
device-mapper-multipath
package.
Procedure
Create the
/etc/multipath.conf
configuration file:mpathconf --enable
# mpathconf --enable
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the
multipathd
service:systemctl enable multipathd.service
# systemctl enable multipathd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
If the
find_multipaths
configuration parameter is not set toon
, edit theblacklist
andblacklist_exceptions
sections of the/etc/multipath.conf
file, as described in Preventing devices from multipathing. Add the WWID of the device to the
/etc/multipath/wwids
file:multipath -a /dev/sdb
# multipath -a /dev/sdb wwid '3600d02300069c9ce09d41c4ac9c53200' added
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace /dev/sdb with the root device name.
Confirm that your configuration file is set up correctly:
multipath -d 3600d02300069c9ce09d41c4ac9c53200
# 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 running
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace 3600d02300069c9ce09d41c4ac9c53200 with the WWID of your swap device.
Rebuild the
initramfs
file system withmultipath
:dracut --force --add multipath
# dracut --force --add multipath
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Shut the machine down.
- Boot the machine.
- Make the other paths visible to the machine.
Verification
Check if the multipath device is created by running the following command:
multipath -l | grep 3600d02300069c9ce09d41c4ac9c53200
# multipath -l | grep 3600d02300069c9ce09d41c4ac9c53200 mpatha (3600d02300069c9ce09d41c4ac9c53200) dm-0 3PARdata,VV
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.3. Moving a swap file system from a single path device to a multipath device Copia collegamentoCollegamento copiato negli appunti!
By default, swap devices are set up as logical volumes. This does not require any special procedure for configuring them as multipath devices if 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
Create the
/etc/multipath.conf
configuration file:mpathconf --enable
# mpathconf --enable
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the
multipathd
service:systemctl enable multipathd.service
# systemctl enable multipathd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
If the
find_multipaths
configuration parameter is not set toon
, edit theblacklist
andblacklist_exceptions
sections of the/etc/multipath.conf
file, as described in Preventing devices from multipathing. Add the WWID of the device to the
/etc/multipath/wwids
file:multipath -a /dev/sdb
# multipath -a /dev/sdb wwid '3600d02300069c9ce09d41c4ac9c53200' added
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace /dev/sdb with the swap device name.
Confirm that your configuration file is set up correctly:
multipath -d 3600d02300069c9ce09d41c4ac9c53200
# 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 running
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace 3600d02300069c9ce09d41c4ac9c53200 with the WWID of your swap device.
Set up an alias for the swap device in the
/etc/multipath.conf
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
/dev/sdb2 swap swap defaults 0 0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the entry to the following:
/dev/mapper/swapdev swap swap defaults 0 0
/dev/mapper/swapdev swap swap defaults 0 0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rebuild the initramfs file system with multipath:
dracut --force --add multipath
# dracut --force --add multipath
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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
# swapon -s Filename Type Size Used Priority /dev/dm-3 partition 4169724 0 -2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The file name should match the multipath swap device.
readlink -f /dev/mapper/swapdev
# readlink -f /dev/mapper/swapdev /dev/dm-3
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.4. Determining device mapper entries for multipath devices Copia collegamentoCollegamento copiato negli appunti!
You can use the multipathd
command to discover which device mapper entries match the multipathed devices.
Procedure
Display all device mapper devices:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.5. Administering the multipathd daemon Copia collegamentoCollegamento copiato negli appunti!
The multipathd
commands can be used to administer the multipathd
daemon.
Procedure
View the default format for the output of the
multipathd show maps
command:multipathd show maps
# multipathd show maps name sysfs uuid mpathc dm-0 360a98000324669436c2b45666c567942
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Some
multipathd
commands include aformat
option followed by a wildcard. Display a list of available wildcards with the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the multipath devices that
multipathd
is monitoring. Use wildcards to specify the shown fields:multipathd show maps format "%n %w %d %s"
# multipathd show maps format "%n %w %d %s" name uuid sysfs vend/prod/rev mpathc 360a98000324669436c2b45666c567942 dm-0 NETAPP,LUN
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the paths that
multipathd
is monitoring. Use wildcards to specify the shown fields:multipathd show paths format "%n %w %d %s"
# multipathd show paths format "%n %w %d %s" target WWNN uuid dev vend/prod/rev 0x50001fe1500d2250 3600508b4001080520001e00011700000 sdb HP,HSV210
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display data in a raw format:
multipathd show maps raw format "%n %w %d %s"
# multipathd show maps raw format "%n %w %d %s" mpathc 360a98000324669436c2b45666c567942 dm-0 NETAPP,LUN
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In raw format, no headers are printed and the fields are not padded to align the columns with the headers. This output can be more easily used for scripting.