File: mdraid-cleanup.sh

package info (click to toggle)
dracut 110-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,356 kB
  • sloc: sh: 24,895; ansic: 5,236; makefile: 346; perl: 186; python: 48; javascript: 19
file content (21 lines) | stat: -rwxr-xr-x 504 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

command -v getarg > /dev/null || . /lib/dracut-lib.sh

containers=""
for md in /dev/md[0-9_]*; do
    [ -b "$md" ] || continue
    udevinfo="$(udevadm info --query=property --name="$md")"
    strstr "$udevinfo" "DEVTYPE=partition" && continue
    if strstr "$udevinfo" "MD_LEVEL=container"; then
        containers="$containers $md"
        continue
    fi
    mdadm -S "$md" > /dev/null 2>&1
done

for md in $containers; do
    mdadm -S "$md" > /dev/null 2>&1
done

unset containers udevinfo