DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk "/^disk/ { print \\\$2 }"`
local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l`
- if [ "$REMOVABLE" == "0" ]; then
+ local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l`
+ if [ "$REMOVABLE" == "0" -a "$LOOPBACK" = "0" ]; then
echo ""
- echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/<n>] "
+ echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
tput sgr 0
read input
if [ "$input" != "y" ] && [ "$input" != "Y" ]; then
DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk '/^(disk|loop)/ { print $2 }'`
local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l`
- if [ "$REMOVABLE" == "0" ]; then
+ local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l`
+ if [ "$REMOVABLE" == "0" -a "$LOOPBACK" = "0" ]; then
echo ""
- echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/<n>] "
+ echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
tput sgr 0
read input
if [ "$input" != "y" ] && [ "$input" != "Y" ]; then
DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk '/^(disk|loop)/ { print $2 }'`
local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l`
- if [ "$REMOVABLE" == "0" ]; then
+ local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l`
+ if [ "$REMOVABLE" == "0" -a "$LOOPBACK" == "0" ]; then
echo ""
- echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/<n>] "
+ echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
tput sgr 0
read input
if [ "$input" != "y" ] && [ "$input" != "Y" ]; then