summaryrefslogtreecommitdiffstats
path: root/main/lvm2/lvm.initd
blob: f077d7f1d93b077e3e97d5557ccdd31216ea9924 (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
#!/sbin/runscript

depend() {
	before checkfs fsck
	after hwdrivers modules device-mapper
}

dm_in_proc() {
	local rc=0 i=
	for i in devices misc; do
		grep -qs 'device-mapper' /proc/$i
		rc=$(($rc + $?))
	done
	return $rc
}

start() {
	local rc=0 msg=
	ebegin "Setting up the Logical Volume Manager"
	if [ -e  /proc/modules ] && ! dm_in_proc; then
		modprobe dm-mod 2>/dev/null
	fi
	if [ -d /proc/lvm ] || dm_in_proc; then
		vgscan --mknodes --ignorelockingfailure >/dev/null 2>&1 &&\
			vgchange --ignorelockingfailure -a y >/dev/null 2>&1
		rc=$?
	else
		rc=1
	fi
	eend $rc
}

stop() {
	ebegin "Shutting down the Logical Volume Manager"
	vgchange --ignorelockingfailure -a n >/dev/null 2>&1
	eend $?
}