summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/lvm2/lvm2_hook
blob: 13183c6a6143b887d365b6ddc9ff697bfb433d45 (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
# vim:set ft=sh:
run_hook ()
{
    /sbin/modprobe -q dm-mod >/dev/null 2>&1
    if [ -e "/sys/class/misc/device-mapper" ]; then
        if [ ! -e "/dev/mapper/control" ]; then
            /bin/mknod "/dev/mapper/control" c $(cat /sys/class/misc/device-mapper/dev | sed 's|:| |')
        fi

        # If the lvmwait= parameter has been specified on the command line
        # wait for the device(s) before trying to activate the volume group(s)
        if [ -n "${lvmwait}" ]; then
            for pvdev in $(echo ${lvmwait} | sed 's|,| |g'); do
                poll_device ${pvdev} ${rootdelay}
            done
        fi

        [ "${quiet}" = "y" ] && LVMQUIET=">/dev/null"

        msg "Scanning logical volumes..."
        eval /sbin/lvm vgscan --ignorelockingfailure $LVMQUIET
        msg "Activating logical volumes..."
        eval /sbin/lvm vgchange --ignorelockingfailure --ignoremonitoring -ay $LVMQUIET
    fi
}