if ! sg_inq $DRIVE | grep -q "130-HOLD"; then echo "Error: 130 hold not active on $DRIVE" exit 1 fi
You will see two main options:
umount $dev* 2>/dev/null