Lines 124-137
Link Here
|
124 |
eend 0 |
124 |
eend 0 |
125 |
|
125 |
|
126 |
# Stop LVM |
126 |
# Stop LVM |
127 |
if [ -x /sbin/vgchange ] && [ -f /etc/lvmtab -o -d /etc/lvm ] && \ |
127 |
if [ -x /sbin/vgchange ] && \ |
|
|
128 |
[ -x /sbin/lvdisplay ] && \ |
129 |
[ -x /sbin/vgdisplay ] && \ |
130 |
[ -x /sbin/lvchange ] && \ |
131 |
[ -f /etc/lvmtab -o -d /etc/lvm ] && \ |
128 |
[ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] |
132 |
[ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] |
129 |
then |
133 |
then |
130 |
ebegin "Shutting down the Logical Volume Manager" |
134 |
einfo "Shutting down the Logical Volume Manager" |
131 |
/sbin/vgchange -a n >/dev/null |
135 |
# If these commands fail it is not currently an issue |
132 |
eend $? "Failed to shut LVM down" |
136 |
# as the system is going down anyway based on the current LVM |
|
|
137 |
# functionality as described in this forum thread |
138 |
#https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html |
139 |
|
140 |
LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|awk '{print $3}'|sort|xargs echo` |
141 |
VOLUME_GROUPS=`vgdisplay |grep "VG Name"|awk '{print $3}'|sort|xargs echo` |
142 |
for x in ${LOGICAL_VOLUMES} |
143 |
do |
144 |
LV_IS_ACTIVE=`lvdisplay ${x}|grep "#"|awk '{print $3}'` |
145 |
if [ "${LV_IS_ACTIVE}" = 0 ] |
146 |
then |
147 |
ebegin " Shutting Down logical volume: ${x} " |
148 |
lvchange -an --ignorelockingfailure -P ${x} >/dev/null |
149 |
eend $? |
150 |
fi |
151 |
done |
152 |
|
153 |
for x in ${VOLUME_GROUPS} |
154 |
do |
155 |
VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|awk '{print $3}'|xargs echo` |
156 |
if [ "${VG_HAS_ACTIVE_LV}" = 0 ] |
157 |
then |
158 |
ebegin " Shutting Down volume group: ${x} " |
159 |
vgchange -an --ignorelockingfailure -P ${x} >/dev/null |
160 |
eend |
161 |
fi |
162 |
done |
163 |
|
164 |
for x in ${LOGICAL_VOLUMES} |
165 |
do |
166 |
LV_IS_ACTIVE=`lvdisplay ${x}|grep "#"|awk '{print $3}'` |
167 |
if [ "${LV_IS_ACTIVE}" = 1 ] |
168 |
then |
169 |
|
170 |
ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'` |
171 |
if [ ! ${ROOT_DEVICE} = ${x} ] |
172 |
then |
173 |
ewarn " Unable to shutdown: ${x} " |
174 |
fi |
175 |
fi |
176 |
done |
177 |
einfo "Finished Shutting down the Logical Volume Manager" |
133 |
fi |
178 |
fi |
134 |
|
179 |
|
|
|
180 |
|
135 |
# This is a function because its used twice below this line as: |
181 |
# This is a function because its used twice below this line as: |
136 |
# [ -f /etc/killpower ] && ups_kill_power |
182 |
# [ -f /etc/killpower ] && ups_kill_power |
137 |
ups_kill_power() { |
183 |
ups_kill_power() { |