/usr/sbin/ocs-lvm2-stop is in clonezilla 3.10.11-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #!/bin/bash
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Borrow from Gentoo, modified to be used in clonezilla by Steven Shiau <steven _at_ nchc org tw>
# We need function disable_lvm2_udevd_rules from drbl-functions, so loading it first.
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
# Stop LVM2
if type vgchange &>/dev/null && \
type lvdisplay &>/dev/null && \
type vgdisplay &>/dev/null && \
type lvchange &>/dev/null && \
[ -f /etc/lvmtab -o -d /etc/lvm ] && \
[ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
then
echo "Shutting down the Logical Volume Manager"
# If these commands fail it is not currently an issue
# as the system is going down anyway based on the current LVM
# functionality as described in this forum thread
#https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
disable_lvm2_udevd_rules
# 2012/Nov/19 For newer version of lvdisplay (>=2.02.95 in Ubuntu 12.10), "LV Path" instead of "LV Name" is the one we want. "LV Name" in the older version output does not contain the full path:
# root@quantal:/tmp# lvdisplay
# --- Logical volume ---
# LV Path /dev/lucid-server/root
# LV Name root
if [ -n "$(LC_ALL=C lvdisplay | grep -E "LV Path")" ]; then
lv_name_grep_term="LV Path"
else
lv_name_grep_term="LV Name"
fi
LOGICAL_VOLUMES=`LC_ALL=C lvdisplay 2>/dev/null|grep "$lv_name_grep_term"|awk '{print $3}'|sort|xargs echo`
VOLUME_GROUPS=`LC_ALL=C vgdisplay 2>/dev/null|grep "VG Name"|awk '{print $3}'|sort|xargs echo`
for x in ${LOGICAL_VOLUMES}
do
LV_IS_ACTIVE=`LC_ALL=C lvdisplay ${x} 2>/dev/null|grep "# open"|awk '{print $3}'`
if [ "${LV_IS_ACTIVE}" = 0 ]
then
echo " Shutting Down logical volume: ${x} "
lvchange -an --ignorelockingfailure -P ${x} >/dev/null 2>&1
# eend $?
fi
done
for x in ${VOLUME_GROUPS}
do
VG_HAS_ACTIVE_LV=`LC_ALL=C vgdisplay ${x} 2>/dev/null|grep "Open LV"|awk '{print $3}'|xargs echo`
if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
then
echo " Shutting Down volume group: ${x} "
vgchange -an --ignorelockingfailure -P ${x} >/dev/null 2>&1
# eend
fi
done
for x in ${LOGICAL_VOLUMES}
do
LV_IS_ACTIVE=`LC_ALL=C lvdisplay ${x} 2>/dev/null|grep "# open"|awk '{print $3}'`
if [ "${LV_IS_ACTIVE}" = 1 ]
then
ROOT_DEVICE=`LC_ALL=C mount|grep " / "|awk '{print $1}'`
if [ ! ${ROOT_DEVICE} = ${x} ]
then
echo " Unable to shutdown: ${x} "
fi
fi
done
echo "Finished Shutting down the Logical Volume Manager"
fi
|