Ubuntu Server Guide Changes, errors and bugs


Device Mapper Multipathing - Usage & Debug


Download 1.27 Mb.
Pdf ko'rish
bet5/37
Sana09.10.2020
Hajmi1.27 Mb.
#132985
1   2   3   4   5   6   7   8   9   ...   37
Bog'liq
ubuntu-server-guide


Device Mapper Multipathing - Usage & Debug
Device Mapper Multipath will be referred here as multipath only.
Before moving on with this session it is recommended that you read: 1. Device Mapper Mul-
tipathing - Introduction 2. Device Mapper Multipathing - Configuration 3. Device Mapper
Multipathing - Setup
43

This section provides step-by-step example procedures for configuring multipath.
It includes the following procedures:
• Resizing Online Multipath Devices
• Moving root File System from a Single Path Device to a Multipath Device
• The Multipath Daemon
• Issues with queue_if_no_path
• Multipath Command Output
• Multipath Queries with multipath Command
• Determining Device Mapper Entries with dmsetup Command
• Troubleshooting with the multipathd interactive console
Resizing Online Multipath Devices
First find all the paths to the LUN about to be resized:
$ sudo m u l t i p a t h − l l
mpathb ( 3 6 0 0 1 4 0 5 6 e e e 8 e c 6 e 1 1 6 4 f c b 9 5 9 0 8 6 4 8 2 ) dm−0 LIO−ORG, l u n 0 1
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 1 s d e 8 : 6 4 a c t i v e ready ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 1 s d f 8 : 8 0 a c t i v e ready ru n n in g
mpatha ( 3 6 0 0 1 4 0 5 e 3 c 2 8 4 1 4 3 0 e e 4 b f 3 8 7 1 b 1 9 9 8 b ) dm−1 LIO−ORG, l u n 0 2
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 2 s d c 8 : 3 2 a c t i v e ready ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 2 sdd 8 : 4 8 a c t i v e ready ru n n in g
Now I’ll reconfigure mpathb (with wwid = 360014056eee8ec6e1164fcb959086482) to have 2GB instead of
just 1Gb and check if has changed:
$ echo 1 | sudo t e e / s y s / b l o c k / s d e / d e v i c e / r e s c a n
1
$ echo 1 | sudo t e e / s y s / b l o c k / s d f / d e v i c e / r e s c a n
1
$ sudo m u l t i p a t h − l l
mpathb ( 3 6 0 0 1 4 0 5 6 e e e 8 e c 6 e 1 1 6 4 f c b 9 5 9 0 8 6 4 8 2 ) dm−0 LIO−ORG, l u n 0 1
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 1 s d e 8 : 6 4 a c t i v e ready ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 1 s d f 8 : 8 0 a c t i v e ready ru n n in g
mpatha ( 3 6 0 0 1 4 0 5 e 3 c 2 8 4 1 4 3 0 e e 4 b f 3 8 7 1 b 1 9 9 8 b ) dm−1 LIO−ORG, l u n 0 2
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 2 s d c 8 : 3 2 a c t i v e ready ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 2 sdd 8 : 4 8 a c t i v e ready ru n n in g
44

Not yet! We still need to re-scan the multipath map:
$ sudo m u l ti p a t h d r e s i z e map mpathb
ok
And then we are good:
$ sudo m u l t i p a t h − l l
mpathb ( 3 6 0 0 1 4 0 5 6 e e e 8 e c 6 e 1 1 6 4 f c b 9 5 9 0 8 6 4 8 2 ) dm−0 LIO−ORG, l u n 0 1
s i z e =2.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 1 s d e 8 : 6 4 a c t i v e ready ru n n in g
.‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 1 s d f 8 : 8 0 a c t i v e ready ru n n in g
mpatha ( 3 6 0 0 1 4 0 5 e 3 c 2 8 4 1 4 3 0 e e 4 b f 3 8 7 1 b 1 9 9 8 b ) dm−1 LIO−ORG, l u n 0 2
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 2 s d c 8 : 3 2 a c t i v e ready ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =50 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 2 sdd 8 : 4 8 a c t i v e ready ru n n in g
Make sure to run resize2fs /dev/mapper/mpathb to resize the filesystem.
Moving root File System from a Single Path Device to a Multipath Device
This is dramatically simplified by the use of UUIDs to identify devices as an intrinsic label. Simply install
multipath-tools-boot and reboot. This will rebuild the initial ramdisk and afford multipath the opportunity
to build it’s paths before the root filesystem is mounted by UUID.
Note
Whenever multipath.conf is updated, so should the initrd by executing:
update−initramfs −u −k all
The reason behind is multipath.conf is copied to the ramdisk and is integral to determining the
available devices to map via it’s blacklist and devices sections.
The Multipath Daemon
If you find you have trouble implementing a multipath configuration, you should ensure the multipath
daemon is running as described in Device Mapper Multipathing - Setup. The multipathd daemon must be
running in order to use** multipath** devices.
Multipath Command Output
When you create, modify, or list a multipath device, you get a printout of the current device setup. The for-
mat is as follows. For each multipath device: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
action_if_any:
alias (wwid_if_different_from_alias) dm_device_name_if_known vendor,product
size=size features=‘features’ hwhandler=‘hardware_handler’ wp=write_permission_if_known ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For each path group: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+- policy=‘scheduling_policy’ prio=prio_if_known status=path_group_status_if_known ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For each path: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
− host:channel:id:lun devnode major:minor dm_status_if_known path_status online_status ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For example, the output of a multipath command might appear as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpathb (360014056eee8ec6e1164fcb959086482)dm−0 LIO−ORG,lun01 size=2.0G features=’0’ hwhandler
=’1 alua’ wp=rw |−+− policy=’service−time 0’ prio=50 status=active |- 7:0:0:1 sde 8:64 active ready
45

running −+− policy=’service−time 0’ prio=50 status=enabled- 8:0:0:1 sdf 8:80 active ready running
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If
the path is up and ready for I/O, the status of the path is ready or ghost. If the path is down, the status
is faulty or shaky. The path status is updated periodically by the multipathd daemon based on the
polling interval defined in the /etc/multipath.conf file.
The dm_status is similar to the path status, but from the kernel’s point of view. The dm_status has two
states: failed, which is analogous to faulty, and active, which covers all other path states. Occasionally,
the path state and the dm state of a device will temporary not agree.
The possible values for online_status are running and offline. A status of offline means that the SCSI
device has been disabled.
Multipath Queries with multipath Command
You can use the -l and -ll options of the multipath command to display the current multipath configuration.
The -l option displays multipath topology gathered from information in sysfs and the device mapper. The
-ll option displays the information the -l displays in addition to all other available components of the system.
When displaying the multipath configuration, there are three verbosity levels you can specify with the -v
option of the multipath command. Specifying -v0 yields no output. Specifying-v1 outputs the created
or updated multipath names only, which you can then feed to other tools such as kpartx. Specifying
-v2 prints all detected paths, multipaths, and device maps.
Note The default verbosity level of multipath is and can be globally modified by defining the
verbosity attribute in the defaults section of multipath.conf.
The following example shows the output of a multipath -l command.
$ sudo m u l t i p a t h − l
mpathb ( 3 6 0 0 1 4 0 5 6 e e e 8 e c 6 e 1 1 6 4 f c b 9 5 9 0 8 6 4 8 2 ) dm−0 LIO−ORG, l u n 0 1
s i z e =2.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =0 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 1 s d e 8 : 6 4 a c t i v e undef ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =0 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 1 s d f 8 : 8 0 a c t i v e undef ru n n i n g
mpatha ( 3 6 0 0 1 4 0 5 e 3 c 2 8 4 1 4 3 0 e e 4 b f 3 8 7 1 b 1 9 9 8 b ) dm−1 LIO−ORG, l u n 0 2
s i z e =1.0G f e a t u r e s = ’0 ’ hwhandler =’1 alua ’ wp=rw
|−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =0 s t a t u s=a c t i v e
| ‘− 7 : 0 : 0 : 2 s d c 8 : 3 2 a c t i v e undef ru n n in g
‘−+− p o l i c y =’ s e r v i c e −time 0 ’ p r i o =0 s t a t u s=e n a b l e d
‘− 8 : 0 : 0 : 2 sdd 8 : 4 8 a c t i v e undef ru n n in g
Determining Device Mapper Entries with dmsetup Command
You can use the dmsetup command to find out which device mapper entries match the multipathed devices.
The following command displays 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 1 corresponds to the
multipathd device /dev/dm-1.
$ sudo dmsetup l s
mpathb
( 2 5 3 : 0 )
mpatha
( 2 5 3 : 1 )
$ l s −l a h d / dev /dm*
46

brw−rw−−−− 1 r o o t d i s k 2 5 3 , 0 Apr 27 1 4 : 4 9 / dev /dm−0
brw−rw−−−− 1 r o o t d i s k 2 5 3 , 1 Apr 27 1 4 : 4 7 / dev /dm−1
Troubleshooting with the multipathd interactive console
The multipathd -k command is an interactive interface to the multipathd daemon. Entering this command
brings up an interactive multipath console. After entering this command, you can enter help to get a list of
available commands, you can enter a interactive command, or you can enter CTRL-D to quit.
The multipathd interactive console can be used to troubleshoot problems you may be having with your system.
For example, the following command sequence displays the multipath configuration, including the defaults,
before exiting the console. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ sudo multipathd -k > show config > CTRL-D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following command sequence ensures that multipath has picked up any changes to the multipath.conf,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$
sudo multipathd -k > reconfigure > CTRL-D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the following command sequence to ensure that the path checker is working properly. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ sudo multipathd -k > show paths > CTRL-D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commands can also be streamed into multipathd using STDIN like so: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ echo ‘show config’ | sudo multipathd -k ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Networking
Networks consist of two or more devices, such as computer systems, printers, and related equipment which are
connected by either physical cabling or wireless links for the purpose of sharing and distributing information
among the connected devices.
This section provides general and specific information pertaining to networking, including an overview of
network concepts and detailed discussion of popular network protocols.
TCP/IP
The Transmission Control Protocol and Internet Protocol (TCP/IP) is a standard set of protocols developed
in the late 1970s by the Defense Advanced Research Projects Agency (DARPA) as a means of communication
between different types of computers and computer networks. TCP/IP is the driving force of the Internet,
and thus it is the most popular set of network protocols on Earth.
TCP/IP Introduction
The two protocol components of TCP/IP deal with different aspects of computer networking. Internet
Protocol, the “IP” of TCP/IP is a connectionless protocol which deals only with network packet routing
using the IP Datagram as the basic unit of networking information. The IP Datagram consists of a header
followed by a message. The Transmission Control Protocol is the “TCP” of TCP/IP and enables network
hosts to establish connections which may be used to exchange data streams. TCP also guarantees that the
data between connections is delivered and that it arrives at one network host in the same order as sent from
another network host.
47

TCP/IP Configuration
The TCP/IP protocol configuration consists of several elements which must be set by editing the appropriate
configuration files, or deploying solutions such as the Dynamic Host Configuration Protocol (DHCP) server
which in turn, can be configured to provide the proper TCP/IP configuration settings to network clients
automatically. These configuration values must be set correctly in order to facilitate the proper network
operation of your Ubuntu system.
The common configuration elements of TCP/IP and their purposes are as follows:
• IP address The IP address is a unique identifying string expressed as four decimal numbers ranging
from zero (0) to two-hundred and fifty-five (255), separated by periods, with each of the four numbers
representing eight (8) bits of the address for a total length of thirty-two (32) bits for the whole address.
This format is called dotted quad notation.
• Netmask The Subnet Mask (or simply, netmask) is a local bit mask, or set of flags which separate
the portions of an IP address significant to the network from the bits significant to the subnetwork.
For example, in a Class C network, the standard netmask is 255.255.255.0 which masks the first three
bytes of the IP address and allows the last byte of the IP address to remain available for specifying
hosts on the subnetwork.
• Network Address The Network Address represents the bytes comprising the network portion of an
IP address. For example, the host 12.128.1.2 in a Class A network would use 12.0.0.0 as the network
address, where twelve (12) represents the first byte of the IP address, (the network part) and zeroes
(0) in all of the remaining three bytes to represent the potential host values. A network host using the
private IP address 192.168.1.100 would in turn use a Network Address of 192.168.1.0, which specifies
the first three bytes of the Class C 192.168.1 network and a zero (0) for all the possible hosts on the
network.
• Broadcast Address The Broadcast Address is an IP address which allows network data to be sent
simultaneously to all hosts on a given subnetwork rather than specifying a particular host. The
standard general broadcast address for IP networks is 255.255.255.255, but this broadcast address
cannot be used to send a broadcast message to every host on the Internet because routers block it.
A more appropriate broadcast address is set to match a specific subnetwork. For example, on the
private Class C IP network, 192.168.1.0, the broadcast address is 192.168.1.255. Broadcast messages
are typically produced by network protocols such as the Address Resolution Protocol (ARP) and the
Routing Information Protocol (RIP).
• Gateway Address A Gateway Address is the IP address through which a particular network, or host
on a network, may be reached. If one network host wishes to communicate with another network host,
and that host is not located on the same network, then a gateway must be used. In many cases, the
Gateway Address will be that of a router on the same network, which will in turn pass traffic on to
other networks or hosts, such as Internet hosts. The value of the Gateway Address setting must be
correct, or your system will not be able to reach any hosts beyond those on the same network.
• Nameserver Address Nameserver Addresses represent the IP addresses of Domain Name Service
(DNS) systems, which resolve network hostnames into IP addresses. There are three levels of Name-
server Addresses, which may be specified in order of precedence: The Primary Nameserver, the Sec-
ondary Nameserver, and the Tertiary Nameserver. In order for your system to be able to resolve network
hostnames into their corresponding IP addresses, you must specify valid Nameserver Addresses which
you are authorized to use in your system’s TCP/IP configuration. In many cases these addresses can
and will be provided by your network service provider, but many free and publicly accessible name-
servers are available for use, such as the Level3 (Verizon) servers with IP addresses from 4.2.2.1 to
4.2.2.6.
Tip
The IP address, Netmask, Network Address, Broadcast Address, Gateway Address, and
48

Nameserver Addresses are typically specified via the appropriate directives in the file /etc/
network/interfaces. For more information, view the system manual page for interfaces , with
the following command typed at a terminal prompt:
Access the system manual page for interfaces with the following command:
man i n t e r f a c e s
IP Routing
IP routing is a means of specifying and discovering paths in a TCP/IP network along which network data
may be sent. Routing uses a set of routing tables to direct the forwarding of network data packets from
their source to the destination, often via many intermediary network nodes known as routers. There are two
primary forms of IP routing: Static Routing and Dynamic Routing.
Static routing involves manually adding IP routes to the system’s routing table, and this is usually done
by manipulating the routing table with the route command. Static routing enjoys many advantages over
dynamic routing, such as simplicity of implementation on smaller networks, predictability (the routing table
is always computed in advance, and thus the route is precisely the same each time it is used), and low
overhead on other routers and network links due to the lack of a dynamic routing protocol. However, static
routing does present some disadvantages as well. For example, static routing is limited to small networks
and does not scale well. Static routing also fails completely to adapt to network outages and failures along
the route due to the fixed nature of the route.
Dynamic routing depends on large networks with multiple possible IP routes from a source to a destination
and makes use of special routing protocols, such as the Router Information Protocol (RIP), which handle the
automatic adjustments in routing tables that make dynamic routing possible. Dynamic routing has several
advantages over static routing, such as superior scalability and the ability to adapt to failures and outages
along network routes. Additionally, there is less manual configuration of the routing tables, since routers
learn from one another about their existence and available routes. This trait also eliminates the possibility
of introducing mistakes in the routing tables via human error. Dynamic routing is not perfect, however,
and presents disadvantages such as heightened complexity and additional network overhead from router
communications, which does not immediately benefit the end users, but still consumes network bandwidth.
TCP and UDP
TCP is a connection-based protocol, offering error correction and guaranteed delivery of data via what is
known as flow control. Flow control determines when the flow of a data stream needs to be stopped, and
previously sent data packets should to be re-sent due to problems such as collisions, for example, thus
ensuring complete and accurate delivery of the data. TCP is typically used in the exchange of important
information such as database transactions.
The User Datagram Protocol (UDP), on the other hand, is a connectionless protocol which seldom deals
with the transmission of important data because it lacks flow control or any other method to ensure reliable
delivery of the data. UDP is commonly used in such applications as audio and video streaming, where it is
considerably faster than TCP due to the lack of error correction and flow control, and where the loss of a
few packets is not generally catastrophic.
ICMP
The Internet Control Messaging Protocol (ICMP) is an extension to the Internet Protocol (IP) as defined
in the Request For Comments (RFC) #792 and supports network packets containing control, error, and
informational messages. ICMP is used by such network applications as the ping utility, which can determine
49

the availability of a network host or device. Examples of some error messages returned by ICMP which
are useful to both network hosts and devices such as routers, include Destination Unreachable and Time
Exceeded.
Daemons
Daemons are special system applications which typically execute continuously in the background and await
requests for the functions they provide from other applications. Many daemons are network-centric; that is,
a large number of daemons executing in the background on an Ubuntu system may provide network-related
functionality. Some examples of such network daemons include the Hyper Text Transport Protocol Daemon
(httpd), which provides web server functionality; the Secure SHell Daemon (sshd), which provides secure
remote login shell and file transfer capabilities; and the Internet Message Access Protocol Daemon (imapd),
which provides E-Mail services.
Download 1.27 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   37




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling