Adjust to new standard of /run
Now that /run seems to be a good standard, make that the default for storing various run-time files, rather than /var/run or /dev/.mdadm. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
5ffdc2dd44
commit
96fd06edce
13
Makefile
13
Makefile
|
@ -66,13 +66,13 @@ MAILCMD =/usr/sbin/sendmail -t
|
||||||
CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
|
CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
|
||||||
# Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
|
# Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
|
||||||
# pivotroot from early boot to late boot.
|
# pivotroot from early boot to late boot.
|
||||||
# /dev is an odd place to put this, but it is the only directory that
|
# /run is best, but for distros that don't support that, /dev can work.
|
||||||
# meets the requirements.
|
MAP_DIR=/run/mdadm
|
||||||
MAP_DIR=/dev/.mdadm
|
|
||||||
MAP_FILE = map
|
MAP_FILE = map
|
||||||
MDMON_DIR = /dev/.mdadm
|
MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
|
||||||
|
MDMON_DIR = $(MAP_DIR)
|
||||||
# place for autoreplace cookies
|
# place for autoreplace cookies
|
||||||
FAILED_SLOTS_DIR = /dev/.mdadm/failed-slots
|
FAILED_SLOTS_DIR = /run/mdadm/failed-slots
|
||||||
DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
|
DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
|
||||||
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
|
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
|
||||||
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
|
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
|
||||||
|
@ -204,7 +204,8 @@ mdassemble.klibc : $(ASSEMBLE_SRCS) $(INCL)
|
||||||
$(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
|
$(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
|
||||||
|
|
||||||
mdadm.8 : mdadm.8.in
|
mdadm.8 : mdadm.8.in
|
||||||
sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' mdadm.8.in > mdadm.8
|
sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \
|
||||||
|
-e 's,{MAP_PATH},$(MAP_PATH),g' mdadm.8.in > mdadm.8
|
||||||
|
|
||||||
mdadm.man : mdadm.8
|
mdadm.man : mdadm.8
|
||||||
nroff -man mdadm.8 > mdadm.man
|
nroff -man mdadm.8 > mdadm.man
|
||||||
|
|
14
mapfile.c
14
mapfile.c
|
@ -38,27 +38,19 @@
|
||||||
* UUID - uuid of the array
|
* UUID - uuid of the array
|
||||||
* path - path where device created: /dev/md/home
|
* path - path where device created: /dev/md/home
|
||||||
*
|
*
|
||||||
* The best place for the mapfile wold be /var/run/mdadm/map. However
|
* The best place for the mapfile is /run/mdadm/map. Distros and users
|
||||||
* it is needed during initramfs early-boot, and /var/run doesn't exist there
|
* which have not switched to /run yet can choose a different location
|
||||||
* and certainly doesn't persist through to normal boot.
|
* at compile time via MAP_DIR and MAP_FILE.
|
||||||
* So we store it in /dev/.mdadm/map but allow this to be changed at
|
|
||||||
* compile time. via MAP_DIR and MAP_FILE
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#include "mdadm.h"
|
#include "mdadm.h"
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifndef MAP_DIR
|
|
||||||
#define MAP_DIR "/dev/.mdadm"
|
|
||||||
#define MAP_FILE "map"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAP_READ 0
|
#define MAP_READ 0
|
||||||
#define MAP_NEW 1
|
#define MAP_NEW 1
|
||||||
#define MAP_LOCK 2
|
#define MAP_LOCK 2
|
||||||
#define MAP_DIRNAME 3
|
#define MAP_DIRNAME 3
|
||||||
#define mapnames(dir, base) { \
|
|
||||||
|
|
||||||
char *mapname[4] = {
|
char *mapname[4] = {
|
||||||
MAP_DIR "/" MAP_FILE,
|
MAP_DIR "/" MAP_FILE,
|
||||||
|
|
27
mdadm.8.in
27
mdadm.8.in
|
@ -1434,7 +1434,7 @@ if safe-mode handling is disabled.
|
||||||
.TP
|
.TP
|
||||||
.BR \-\-rebuild\-map ", " \-r
|
.BR \-\-rebuild\-map ", " \-r
|
||||||
Rebuild the map file
|
Rebuild the map file
|
||||||
.RB ( /var/run/mdadm/map )
|
.RB ( {MAP_PATH} )
|
||||||
that
|
that
|
||||||
.I mdadm
|
.I mdadm
|
||||||
uses to help track which arrays are currently being assembled.
|
uses to help track which arrays are currently being assembled.
|
||||||
|
@ -1641,7 +1641,7 @@ does not create any entries in
|
||||||
but leaves that to
|
but leaves that to
|
||||||
.IR udev .
|
.IR udev .
|
||||||
It does record information in
|
It does record information in
|
||||||
.B /var/run/mdadm/map
|
.B {MAP_PATH}
|
||||||
which will allow
|
which will allow
|
||||||
.I udev
|
.I udev
|
||||||
to choose the correct name.
|
to choose the correct name.
|
||||||
|
@ -2561,11 +2561,7 @@ current host, the device will be rejected.
|
||||||
.PP
|
.PP
|
||||||
.I mdadm
|
.I mdadm
|
||||||
keeps a list of arrays that it has partially assembled in
|
keeps a list of arrays that it has partially assembled in
|
||||||
.B /var/run/mdadm/map
|
.BR {MAP_PATH} .
|
||||||
(or
|
|
||||||
.B /var/run/mdadm.map
|
|
||||||
if the directory doesn't exist. Or maybe even
|
|
||||||
.BR /dev/.mdadm.map ).
|
|
||||||
If no array exists which matches
|
If no array exists which matches
|
||||||
the metadata on the new device,
|
the metadata on the new device,
|
||||||
.I mdadm
|
.I mdadm
|
||||||
|
@ -2709,12 +2705,12 @@ and assemble
|
||||||
.B /dev/md0
|
.B /dev/md0
|
||||||
out of all such devices with a RAID superblock with a minor number of 0.
|
out of all such devices with a RAID superblock with a minor number of 0.
|
||||||
|
|
||||||
.B " mdadm \-\-monitor \-\-scan \-\-daemonise > /var/run/mdadm"
|
.B " mdadm \-\-monitor \-\-scan \-\-daemonise > /run/mdadm/mon.pid"
|
||||||
.br
|
.br
|
||||||
If config file contains a mail address or alert program, run mdadm in
|
If config file contains a mail address or alert program, run mdadm in
|
||||||
the background in monitor mode monitoring all md devices. Also write
|
the background in monitor mode monitoring all md devices. Also write
|
||||||
pid of mdadm daemon to
|
pid of mdadm daemon to
|
||||||
.BR /var/run/mdadm .
|
.BR /run/mdadm/mon.pid .
|
||||||
|
|
||||||
.B " mdadm \-Iq /dev/somedevice"
|
.B " mdadm \-Iq /dev/somedevice"
|
||||||
.br
|
.br
|
||||||
|
@ -2792,21 +2788,10 @@ they contain MD super block, and gives identifying information
|
||||||
.BR mdadm.conf (5)
|
.BR mdadm.conf (5)
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
.SS /var/run/mdadm/map
|
.SS {MAP_PATH}
|
||||||
When
|
When
|
||||||
.B \-\-incremental
|
.B \-\-incremental
|
||||||
mode is used, this file gets a list of arrays currently being created.
|
mode is used, this file gets a list of arrays currently being created.
|
||||||
If
|
|
||||||
.B /var/run/mdadm
|
|
||||||
does not exist as a directory, then
|
|
||||||
.B /var/run/mdadm.map
|
|
||||||
is used instead. If
|
|
||||||
.B /var/run
|
|
||||||
is not available (as may be the case during early boot),
|
|
||||||
.B /dev/.mdadm.map
|
|
||||||
is used on the basis that
|
|
||||||
.B /dev
|
|
||||||
is usually available very early in boot.
|
|
||||||
|
|
||||||
.SH DEVICE NAMES
|
.SH DEVICE NAMES
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
# When used in --follow (aka --monitor) mode, mdadm needs a
|
# When used in --follow (aka --monitor) mode, mdadm needs a
|
||||||
# mail address and/or a program. This can be given with "mailaddr"
|
# mail address and/or a program. This can be given with "mailaddr"
|
||||||
# and "program" lines to that monitoring can be started using
|
# and "program" lines to that monitoring can be started using
|
||||||
# mdadm --follow --scan & echo $! > /var/run/mdadm
|
# mdadm --follow --scan & echo $! > /run/mdadm/mon.pid
|
||||||
# If the lines are not found, mdadm will exit quietly
|
# If the lines are not found, mdadm will exit quietly
|
||||||
#MAILADDR root@mydomain.tld
|
#MAILADDR root@mydomain.tld
|
||||||
#PROGRAM /usr/sbin/handle-mdadm-events
|
#PROGRAM /usr/sbin/handle-mdadm-events
|
||||||
|
|
10
mdadm.h
10
mdadm.h
|
@ -71,10 +71,10 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||||
|
|
||||||
/* MAP_DIR should be somewhere that persists across the pivotroot
|
/* MAP_DIR should be somewhere that persists across the pivotroot
|
||||||
* from early boot to late boot.
|
* from early boot to late boot.
|
||||||
* Currently /dev seems to be the only option on most distros.
|
* /run seems to have emerged as the best standard.
|
||||||
*/
|
*/
|
||||||
#ifndef MAP_DIR
|
#ifndef MAP_DIR
|
||||||
#define MAP_DIR "/dev/.mdadm"
|
#define MAP_DIR "/run/mdadm"
|
||||||
#endif /* MAP_DIR */
|
#endif /* MAP_DIR */
|
||||||
/* MAP_FILE is what we name the map file we put in MAP_DIR, in case you
|
/* MAP_FILE is what we name the map file we put in MAP_DIR, in case you
|
||||||
* want something other than the default of "map"
|
* want something other than the default of "map"
|
||||||
|
@ -83,7 +83,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||||
#define MAP_FILE "map"
|
#define MAP_FILE "map"
|
||||||
#endif /* MAP_FILE */
|
#endif /* MAP_FILE */
|
||||||
/* MDMON_DIR is where pid and socket files used for communicating
|
/* MDMON_DIR is where pid and socket files used for communicating
|
||||||
* with mdmon normally live. It *should* be /var/run, but when
|
* with mdmon normally live. Best is /var/run/mdadm as
|
||||||
* mdmon is needed at early boot then it needs to write there prior
|
* mdmon is needed at early boot then it needs to write there prior
|
||||||
* to /var/run being mounted read/write, and it also then needs to
|
* to /var/run being mounted read/write, and it also then needs to
|
||||||
* persist beyond when /var/run is mounter read-only. So, to be
|
* persist beyond when /var/run is mounter read-only. So, to be
|
||||||
|
@ -91,7 +91,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||||
* boot process and stays up as long as possible during shutdown.
|
* boot process and stays up as long as possible during shutdown.
|
||||||
*/
|
*/
|
||||||
#ifndef MDMON_DIR
|
#ifndef MDMON_DIR
|
||||||
#define MDMON_DIR "/dev/.mdadm/"
|
#define MDMON_DIR "/run/mdadm"
|
||||||
#endif /* MDMON_DIR */
|
#endif /* MDMON_DIR */
|
||||||
|
|
||||||
/* FAILED_SLOTS is where to save files storing recent removal of array
|
/* FAILED_SLOTS is where to save files storing recent removal of array
|
||||||
|
@ -99,7 +99,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||||
* slot for array recovery
|
* slot for array recovery
|
||||||
*/
|
*/
|
||||||
#ifndef FAILED_SLOTS_DIR
|
#ifndef FAILED_SLOTS_DIR
|
||||||
#define FAILED_SLOTS_DIR "/dev/.mdadm/failed-slots"
|
#define FAILED_SLOTS_DIR "/run/mdadm/failed-slots"
|
||||||
#endif /* FAILED_SLOTS */
|
#endif /* FAILED_SLOTS */
|
||||||
|
|
||||||
#include "md_u.h"
|
#include "md_u.h"
|
||||||
|
|
2
mdmon.8
2
mdmon.8
|
@ -218,7 +218,7 @@ and
|
||||||
.B .sock
|
.B .sock
|
||||||
file. The particular filesystem to use is given to mdmon at compile
|
file. The particular filesystem to use is given to mdmon at compile
|
||||||
time and defaults to
|
time and defaults to
|
||||||
.BR /dev/.mdadm .
|
.BR /run/mdadm .
|
||||||
|
|
||||||
This filesystem must persist through to shutdown time.
|
This filesystem must persist through to shutdown time.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue