aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/fedora-storage-init
blob: a9c12769c1e533632fdd292d306bd1cc4d8c2885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
#
# Storage initialization

. /etc/init.d/functions

[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline)

[ -f /etc/crypttab ] && init_crypto 0

if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && \
		[ -x /sbin/multipath ]; then
	modprobe dm-multipath > /dev/null 2>&1
	/sbin/multipath -v 0
	if [ -x /sbin/kpartx ]; then
		/sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" >/dev/null
	fi
fi

if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then
	modprobe dm-mirror >/dev/null 2>&1
	dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i)
	if [ "$?" = "0" ]; then
		for dmname in $dmraidsets; do
			if [[ "$dmname" == isw_* ]] && \
			   ! strstr "$cmdline" noiswmd; then
				continue
			fi
			/sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1
			/sbin/kpartx -a -p p "/dev/mapper/$dmname"
		done
	fi
fi

# Start any MD RAID arrays that haven't been started yet
[ -r /proc/mdstat -a -r /dev/md/md-device-map ] && /sbin/mdadm -IRs

if [ -x /sbin/lvm ]; then
	action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit
fi

[ -f /etc/crypttab ] && init_crypto 0