From b935de9d7be296aca2dfffbc97fdcdf0beb69ea0 Mon Sep 17 00:00:00 2001 From: bougyman Date: Tue, 7 Apr 2015 12:11:49 -0500 Subject: 3: Detect and deactivate LVM Volume Groups on shutdown --- functions | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'functions') diff --git a/functions b/functions index 35449c1..971d288 100644 --- a/functions +++ b/functions @@ -34,3 +34,22 @@ detect_virt() { export VIRTUALIZATION=1 fi } + +deactivate_vgs() { + _group=${1:-All} + if [ -x /sbin/vgchange ]; then + vgs=$(vgs|wc -l) + if [ $vgs -gt 0 ]; then + msg "Deactivating $_group LVM Volume Groups..." + vgchange -an + fi + fi +} + +deactivate_crypt() { + if [ -x /sbin/dmsetup ]; then + msg "Deactivating Crypt Volumes" + dmsetup ls --target crypt --exec 'cryptsetup close' + deactivate_vgs "Crypt" + fi +} -- cgit 1.4.1