ezonakiusagi/bht

Check for mounts through devmapper

raleeper opened this issue · 0 comments

Encrypted disks mounted using devmapper are not detected. /etc/mtab shows the mapped device name not the underlying device. Adding this code to the check loop

    # make sure it is not mounted through devmapper
    if (( $(ls -1 /sys/block/dm-*/slaves | awk -v dev="^${HDD_LIST[i]}[0-9]*" \
	'BEGIN{i=0} "/dev/" $1~dev {i++} END{print i}') > 0 )) ; then
	print "WARN: ${HDD_LIST[i]} appears to be mounted via devmapper. removing from list."
	unset HDD_LIST[i]
	continue
    fi

worked for me.