blob: a1407718d55649a5709a1eab22b57d15439f95fc [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From eb5a36e6e0caedf06008e48eb77b7bf7c6534ee5 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 26 Nov 2018 09:55:12 +0800
4Subject: [PATCH] From 0000000000000000000000000000000000000000 Mon Sep 17
5 00:00:00 2001 From: Benjamin Marzinski <bmarzins@redhat.com> Date: Thu, 16
6 Oct 2014 15:49:01 -0500 Subject: [PATCH] RH: add mpathconf
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007
8mpathconf is a program (largely based on lvmcomf) to help users
9configure /etc/multipath.conf and enable or disable multipathing. It
10has a couple of built-in options that can be set directly from the
11command line. But, mostly it is used to get a multipath.conf file
12with the OS defaults, and to enable and disable multipathing via
13a single command.
14
15Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Brad Bishop19323692019-04-05 15:28:33 -040016
17Upstream-Status: Pending
18
19update this patch to new version
20
21Signed-off-by: Changqing Li <changqing.li@windriver.com>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022---
23 libmultipath/config.c | 1 +
24 multipath/Makefile | 5 +
25 multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++++++++++
26 multipath/mpathconf.8 | 101 +++++++++++
27 4 files changed, 571 insertions(+)
28 create mode 100644 multipath/mpathconf
29 create mode 100644 multipath/mpathconf.8
30
31diff --git a/libmultipath/config.c b/libmultipath/config.c
Brad Bishop19323692019-04-05 15:28:33 -040032index e4233f1..b779505 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033--- a/libmultipath/config.c
34+++ b/libmultipath/config.c
Brad Bishop19323692019-04-05 15:28:33 -040035@@ -747,6 +747,7 @@ load_config (char * file)
36 factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037 } else {
38 condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
39+ condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf");
40 if (conf->blist_devnode == NULL) {
41 conf->blist_devnode = vector_alloc();
42 if (!conf->blist_devnode) {
43diff --git a/multipath/Makefile b/multipath/Makefile
44index b9bbb3c..e720c7f 100644
45--- a/multipath/Makefile
46+++ b/multipath/Makefile
47@@ -18,10 +18,12 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
48 $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
49 $(GZIP) $(EXEC).8 > $(EXEC).8.gz
50 $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
51+ $(GZIP) mpathconf.8 > mpathconf.8.gz
52
53 install:
54 $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
55 $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
56+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
57 $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
58 $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
59 $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
60@@ -29,13 +31,16 @@ install:
61 $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir)
62 $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
63 $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
64+ $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(man8dir)
65
66 uninstall:
67 $(RM) $(DESTDIR)$(bindir)/$(EXEC)
68 $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
69 $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
70+ $(RM) $(DESTDIR)$(bindir)/mpathconf
71 $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
72 $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
73+ $(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz
74
75 clean: dep_clean
76 $(RM) core *.o $(EXEC) *.gz
77diff --git a/multipath/mpathconf b/multipath/mpathconf
78new file mode 100644
79index 0000000..e839134
80--- /dev/null
81+++ b/multipath/mpathconf
82@@ -0,0 +1,464 @@
83+#!/bin/bash
84+#
85+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
86+#
87+# This file is part of the device-mapper-multipath package.
88+#
89+# This copyrighted material is made available to anyone wishing to use,
90+# modify, copy, or redistribute it subject to the terms and conditions
91+# of the GNU General Public License v.2.
92+#
93+# You should have received a copy of the GNU General Public License
94+# along with this program; if not, write to the Free Software Foundation,
95+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
96+
97+#
98+# Simple editting of /etc/multipath.conf
99+# This program was largely ripped off from lvmconf
100+#
101+
102+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST
103+
104+DEFAULT_CONFIG="# device-mapper-multipath configuration file
105+
106+# For a complete list of the default configuration values, run either:
107+# # multipath -t
108+# or
109+# # multipathd show config
110+
111+# For a list of configuration options with descriptions, see the
112+# multipath.conf man page.
113+
114+defaults {
115+ user_friendly_names yes
116+ find_multipaths yes
117+}
118+
119+blacklist_exceptions {
120+ property \"(SCSI_IDENT_|ID_WWN)\"
121+}"
122+
123+CONFIGFILE="/etc/multipath.conf"
124+OUTPUTFILE="/etc/multipath.conf"
125+MULTIPATHDIR="/etc/multipath"
126+TMPFILE="/etc/multipath/.multipath.conf.tmp"
127+WWIDS=0
128+
129+function usage
130+{
131+ echo "usage: $0 <command>"
132+ echo ""
133+ echo "Commands:"
134+ echo "Enable: --enable "
135+ echo "Disable: --disable"
136+ echo "Only allow certain wwids (instead of enable): --allow <WWID>"
137+ echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
138+ echo "Set find_multipaths (Default y): --find_multipaths <y|n>"
139+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
140+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
141+ echo "select output file (Default /etc/multipath.conf): --outfile <FILE>"
142+ echo ""
143+}
144+
145+function add_wwid
146+{
147+ INDEX=0
148+ while [ "$INDEX" -lt "$WWIDS" ] ; do
149+ if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then
150+ return
151+ fi
152+ ((INDEX++))
153+ done
154+ WWID_LIST[$WWIDS]="$1"
155+ ((WWIDS++))
156+}
157+
158+function get_dm_deps
159+{
160+ shift 3
161+ while [ -n "$1" -a -n "$2" ]; do
162+ MAJOR=$(echo $1 | tr -d '(,')
163+ MINOR=$(echo $2 | tr -d ')')
164+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
165+ if [ -n "$UUID" ] ; then
166+ set_dm_wwid $UUID
167+ fi
168+ shift 2
169+ done
170+}
171+
172+function set_dm_wwid
173+{
174+ if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
175+ add_wwid "${1##part*-mpath-}"
176+ elif [[ "$1" =~ ^mpath- ]] ; then
177+ add_wwid "${1##mpath-}"
178+ else
179+ get_dm_deps `dmsetup deps -u $1`
180+ fi
181+}
182+
183+function set_wwid
184+{
185+ UUID=""
186+ if [[ "$1" =~ ^[[:digit:]]+:[[:digit:]]+$ ]] ; then
187+ MAJOR=${1%%:*}
188+ MINOR=${1##*:}
189+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
190+ else
191+ UUID=`dmsetup info -c --noheadings -o uuid $1 2> /dev/null`
192+ fi
193+ if [ -n "$UUID" ] ; then
194+ set_dm_wwid $UUID
195+ else
196+ add_wwid "$1"
197+ fi
198+}
199+
200+function parse_args
201+{
202+ while [ -n "$1" ]; do
203+ case $1 in
204+ --enable)
205+ ENABLE=1
206+ shift
207+ ;;
208+ --disable)
209+ ENABLE=0
210+ shift
211+ ;;
212+ --allow)
213+ ENABLE=2
214+ if [ -n "$2" ]; then
215+ set_wwid $2
216+ shift 2
217+ else
218+ usage
219+ exit 1
220+ fi
221+ ;;
222+ --user_friendly_names)
223+ if [ -n "$2" ]; then
224+ FRIENDLY=$2
225+ shift 2
226+ else
227+ usage
228+ exit 1
229+ fi
230+ ;;
231+ --find_multipaths)
232+ if [ -n "$2" ]; then
233+ FIND=$2
234+ shift 2
235+ else
236+ usage
237+ exit 1
238+ fi
239+ ;;
240+ --with_module)
241+ if [ -n "$2" ]; then
242+ MODULE=$2
243+ shift 2
244+ else
245+ usage
246+ exit 1
247+ fi
248+ ;;
249+ --with_multipathd)
250+ if [ -n "$2" ]; then
251+ MULTIPATHD=$2
252+ shift 2
253+ else
254+ usage
255+ exit 1
256+ fi
257+ ;;
258+ --outfile)
259+ if [ -n "$2" ]; then
260+ OUTPUTFILE=$2
261+ HAVE_OUTFILE=1
262+ shift 2
263+ else
264+ usage
265+ exit 1
266+ fi
267+ ;;
268+ *)
269+ usage
270+ exit
271+ esac
272+ done
273+}
274+
275+function validate_args
276+{
277+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then
278+ echo "ignoring extra parameters on disable"
279+ FRIENDLY=""
280+ FIND=""
281+ MODULE=""
282+ fi
283+ if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
284+ echo "--user_friendly_names must be either 'y' or 'n'"
285+ exit 1
286+ fi
287+ if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then
288+ echo "--find_multipaths must be either 'y' or 'n'"
289+ exit 1
290+ fi
291+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then
292+ SHOW_STATUS=1
293+ fi
294+ if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
295+ echo "--with_module must be either 'y' or 'n'"
296+ exit 1
297+ fi
298+ if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
299+ echo "--with_multipathd must be either 'y' or 'n'"
300+ exit 1
301+ fi
302+ if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then
303+ echo "Because --allow makes changes that cannot be automatically reversed,"
304+ echo "you must set --outfile when you set --allow"
305+ exit 1
306+ fi
307+}
308+
309+function add_blacklist_exceptions
310+{
311+ INDEX=0
312+ while [ "$INDEX" -lt "$WWIDS" ] ; do
313+ sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
314+ wwid '"\"${WWID_LIST[$INDEX]}\""'
315+' $TMPFILE
316+ ((INDEX++))
317+ done
318+}
319+
320+umask 0077
321+
322+parse_args "$@"
323+
324+validate_args
325+
326+if [ ! -d "$MULTIPATHDIR" ]; then
327+ echo "/etc/multipath/ does not exist. failing"
328+ exit 1
329+fi
330+
331+rm $TMPFILE 2> /dev/null
332+echo "$DEFAULT_CONFIG" > $TMPFILE
333+if [ -f "$CONFIGFILE" ]; then
334+ cp $CONFIGFILE $TMPFILE
335+fi
336+
337+if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then
338+ HAVE_BLACKLIST=1
339+fi
340+
341+if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then
342+ HAVE_EXCEPTIONS=1
343+fi
344+
345+if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
346+ HAVE_DEFAULTS=1
347+fi
348+
349+if [ -z "$MODULE" -o "$MODULE" = "y" ]; then
350+ if lsmod | grep -q "dm_multipath" ; then
351+ HAVE_MODULE=1
352+ else
353+ HAVE_MODULE=0
354+ fi
355+fi
356+
357+if [ "$MULTIPATHD" = "y" ]; then
358+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
359+ HAVE_MULTIPATHD=1
360+ else
361+ HAVE_MULTIPATHD=0
362+ fi
363+fi
364+
365+if [ "$HAVE_BLACKLIST" = "1" ]; then
366+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
367+ HAVE_DISABLE=1
368+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then
369+ HAVE_DISABLE=0
370+ fi
371+fi
372+
373+if [ "$HAVE_BLACKLIST" = "1" ]; then
374+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then
375+ HAVE_WWID_DISABLE=1
376+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then
377+ HAVE_WWID_DISABLE=0
378+ fi
379+fi
380+
381+if [ "$HAVE_DEFAULTS" = "1" ]; then
382+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then
383+ HAVE_FIND=1
384+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then
385+ HAVE_FIND=0
386+ fi
387+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
388+ HAVE_FRIENDLY=1
389+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
390+ HAVE_FRIENDLY=0
391+ fi
392+fi
393+
394+if [ -n "$SHOW_STATUS" ]; then
395+ if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then
396+ echo "multipath is enabled"
397+ else
398+ echo "multipath is disabled"
399+ fi
400+ if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then
401+ echo "find_multipaths is disabled"
402+ else
403+ echo "find_multipaths is enabled"
404+ fi
405+ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
406+ echo "user_friendly_names is disabled"
407+ else
408+ echo "user_friendly_names is enabled"
409+ fi
410+ if [ -n "$HAVE_MODULE" ]; then
411+ if [ "$HAVE_MODULE" = 1 ]; then
412+ echo "dm_multipath module is loaded"
413+ else
414+ echo "dm_multipath module is not loaded"
415+ fi
416+ fi
417+ if [ -z "$HAVE_MULTIPATHD" ]; then
418+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
419+ HAVE_MULTIPATHD=1
420+ else
421+ HAVE_MULTIPATHD=0
422+ fi
423+ fi
424+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
425+ echo "multipathd is running"
426+ else
427+ echo "multipathd is not running"
428+ fi
429+ exit 0
430+fi
431+
432+if [ -z "$HAVE_BLACKLIST" ]; then
433+ cat >> $TMPFILE <<- _EOF_
434+
435+blacklist {
436+}
437+_EOF_
438+fi
439+
440+if [ -z "$HAVE_DEFAULTS" ]; then
441+ cat >> $TMPFILE <<- _EOF_
442+
443+defaults {
444+}
445+_EOF_
446+fi
447+
448+if [ "$ENABLE" = 2 ]; then
449+ if [ "$HAVE_DISABLE" = 1 ]; then
450+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
451+ fi
452+ if [ -z "$HAVE_WWID_DISABLE" ]; then
453+ sed -i '/^blacklist[[:space:]]*{/ a\
454+ wwid ".*"
455+' $TMPFILE
456+ elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
457+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE
458+ fi
459+ if [ "$HAVE_EXCEPTIONS" = 1 ]; then
460+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
461+ else
462+ cat >> $TMPFILE <<- _EOF_
463+
464+blacklist_exceptions {
465+}
466+_EOF_
467+ fi
468+ add_blacklist_exceptions
469+elif [ "$ENABLE" = 1 ]; then
470+ if [ "$HAVE_DISABLE" = 1 ]; then
471+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
472+ fi
473+elif [ "$ENABLE" = 0 ]; then
474+ if [ -z "$HAVE_DISABLE" ]; then
475+ sed -i '/^blacklist[[:space:]]*{/ a\
476+ devnode ".*"
477+' $TMPFILE
478+ elif [ "$HAVE_DISABLE" = 0 ]; then
479+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
480+ fi
481+fi
482+
483+if [ "$FIND" = "n" ]; then
484+ if [ "$HAVE_FIND" = 1 ]; then
485+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/ find_multipaths no/' $TMPFILE
486+ CHANGED_CONFIG=1
487+ fi
488+elif [ "$FIND" = "y" ]; then
489+ if [ -z "$HAVE_FIND" ]; then
490+ sed -i '/^defaults[[:space:]]*{/ a\
491+ find_multipaths yes
492+' $TMPFILE
493+ CHANGED_CONFIG=1
494+ elif [ "$HAVE_FIND" = 0 ]; then
495+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/ find_multipaths yes/' $TMPFILE
496+ CHANGED_CONFIG=1
497+ fi
498+fi
499+
500+if [ "$FRIENDLY" = "n" ]; then
501+ if [ "$HAVE_FRIENDLY" = 1 ]; then
502+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
503+ CHANGED_CONFIG=1
504+ fi
505+elif [ "$FRIENDLY" = "y" ]; then
506+ if [ -z "$HAVE_FRIENDLY" ]; then
507+ sed -i '/^defaults[[:space:]]*{/ a\
508+ user_friendly_names yes
509+' $TMPFILE
510+ CHANGED_CONFIG=1
511+ elif [ "$HAVE_FRIENDLY" = 0 ]; then
512+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
513+ CHANGED_CONFIG=1
514+ fi
515+fi
516+
517+if [ -f "$OUTPUTFILE" ]; then
518+ cp $OUTPUTFILE $OUTPUTFILE.old
519+ if [ $? != 0 ]; then
520+ echo "failed to backup old config file, $OUTPUTFILE not updated"
521+ exit 1
522+ fi
523+fi
524+
525+cp $TMPFILE $OUTPUTFILE
526+if [ $? != 0 ]; then
527+ echo "failed to copy new config file into place, check $OUTPUTFILE is still OK"
528+ exit 1
529+fi
530+
531+rm -f $TMPFILE
532+
533+if [ "$ENABLE" = 1 ]; then
534+ if [ "$HAVE_MODULE" = 0 ]; then
535+ modprobe dm_multipath
536+ fi
537+ if [ "$HAVE_MULTIPATHD" = 0 ]; then
538+ systemctl start multipathd.service
539+ fi
540+elif [ "$ENABLE" = 0 ]; then
541+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
542+ systemctl stop multipathd.service
543+ fi
544+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
545+ systemctl reload multipathd.service
546+fi
547diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
548new file mode 100644
549index 0000000..4cd3267
550--- /dev/null
551+++ b/multipath/mpathconf.8
552@@ -0,0 +1,101 @@
553+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
554+.SH NAME
555+mpathconf - A tool for configuring device-mapper-multipath
556+.SH SYNOPSIS
557+.B mpathconf
558+.RB [\| commands \|]
559+.RB [\| options \|]
560+.SH DESCRIPTION
561+.B mpathconf
562+is a utility that creates or modifies
563+.B /etc/multipath.conf.
564+It can enable or disable multipathing and configure some common options.
565+.B mpathconf
566+can also load the
567+.B dm_multipath
568+module, start and stop the
569+.B multipathd
570+daemon, and configure the
571+.B multipathd
572+service to start automatically or not. If
573+.B mpathconf
574+is called with no commands, it will display the current configuration.
575+
576+The default options for mpathconf are
577+.B --with_module
578+The
579+.B --with_multipathd
580+option is not set by default. Enabling multipathing will load the
581+.B dm_multipath
582+module but it will not immediately start it. This is so
583+that users can manually edit their config file if necessary, before starting
584+.B multipathd.
585+
586+If
587+.B /etc/multipath.conf
588+already exists, mpathconf will edit it. If it does not exist, mpathconf will
589+create a default file with
590+.B user_friendly_names
591+and
592+.B find_multipaths
593+set. To disable these, use the
594+.B --user_friendly_names n
595+and
596+.B --find_multipaths n
597+options
598+.SH COMMANDS
599+.TP
600+.B --enable
601+Removes any line that blacklists all device nodes from the
602+.B /etc/multipath.conf
603+blacklist section.
604+.TP
605+.B --disable
606+Adds a line that blacklists all device nodes to the
607+.B /etc/multipath.conf
608+blacklist section. If no blacklist section exists, it will create one.
609+.TP
610+.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
611+If set to \fBy\fP, this adds the line
612+.B user_friendly_names yes
613+to the
614+.B /etc/multipath.conf
615+defaults section. If set to \fBn\fP, this removes the line, if present. This
616+command can be used along with any other command.
617+.TP
618+.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
619+If set to \fBy\fP, this adds the line
620+.B find_multipaths yes
621+to the
622+.B /etc/multipath.conf
623+defaults section. If set to \fBn\fP, this removes the line, if present. This
624+command can be used aldong with any other command.
625+.SH OPTIONS
626+.TP
627+.B --with_module\fP { \fBy\fP | \fBn\fP }
628+If set to \fBy\fP, this runs
629+.B modprobe dm_multipath
630+to install the multipath modules. This option only works with the
631+.B --enable
632+command. This option is set to \fBy\fP by default.
633+.TP
634+.B --with_multipathd { \fBy\fP | \fBn\fP }
635+If set to \fBy\fP, this runs
636+.B service multipathd start
637+to start the multipathd daemon on \fB--enable\fP,
638+.B service multipathd stop
639+to stop the multipathd daemon on \fB--disable\fP, and
640+.B service multipathd reload
641+to reconfigure multipathd on \fB--user_frindly_names\fP and
642+\fB--find_multipaths\fP.
643+This option is set to \fBn\fP by default.
644+.SH FILES
645+.BR /etc/multipath.conf
646+.SH "SEE ALSO"
647+.BR multipath.conf (5),
648+.BR modprobe (8),
649+.BR multipath (8),
650+.BR multipathd (8),
651+.BR service (8),
652+.SH AUTHOR
653+Benjamin Marzinski <bmarzins@redhat.com>
654--
6552.7.4
656