File: md-devices

package info (click to toggle)
partman-md 114
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,792 kB
  • sloc: sh: 777; makefile: 2
file content (31 lines) | stat: -rwxr-xr-x 802 bytes parent folder | download | duplicates (8)
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
#!/bin/sh

. /lib/partman/lib/base.sh

db_register partman-md/confirm partman-md/confirm_nooverwrite

# Load modules and scan arrays if it was not done before
if [ ! -f /var/lib/partman/md ] && [ "$(udpkg --print-os)" = linux ] ; then
	#  load required kernel modules 
	depmod -a >/dev/null 2>&1
	modprobe md-mod >/dev/null 2>&1

	# make sure that md is available
	if [ ! -e /proc/mdstat ]; then
		db_input critical partman-md/nomd
		db_go
		exit 0
	fi

	# Try to detect MD devices, and start them
	# mdadm will fail if /dev/md does not already exist
	mkdir -p /dev/md

	log-output -t md-devices --pass-stdout \
		mdadm --examine --scan --config=partitions >/tmp/mdadm.conf

	log-output -t md-devices \
		mdadm --assemble --scan --run --config=/tmp/mdadm.conf --auto=yes

	touch /var/lib/partman/md
fi