Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions detect_mounts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,29 @@ fi
mount_tmp=`mktemp /tmp/mount_temp.XXXXX`
mount | cut -d' ' -f1 > $mount_tmp
#
# Now lvms
# Any disk that is an LVM physical volume is in use — even if no
# LV on it is currently mounted. A benchmark (fio, iozone, etc.)
# writing to that disk would destroy the volume group.
#
if [[ -d /dev/mapper ]]; then
pushd /dev/mapper > /dev/null
for i in `ls | grep -v control`; do
value=`lvdisplay --maps /dev/mapper/$i | grep "Physical volume" | cut -d'/' -f2-`
echo /$value >> $mount_tmp
done
popd > /dev/null
if command -v pvs &>/dev/null; then
pv_output=$(pvs --noheadings -o pv_name 2>&1)
if [ $? -ne 0 ]; then
echo "Error: pvs query failed: $pv_output" >&2
Comment thread
sayalibhavsar marked this conversation as resolved.
for var in "$@"; do
echo "$var" >> $mount_tmp
done
else
for pv in $(echo "$pv_output" | awk '{print $1}'); do
echo "$pv" >> $mount_tmp
pv_base=${pv#/dev/}
if [[ $pv_base =~ ^nvme || $pv_base =~ ^mmcblk ]]; then
pv_base=$(echo "$pv_base" | sed 's/p[[:digit:]]*$//')
else
pv_base=$(echo "$pv_base" | sed 's/[[:digit:]]*$//')
fi
echo "/dev/$pv_base" >> $mount_tmp
done
fi
fi
#
# Now check for mounted
Expand Down
Loading