umount multiple mounts under same directory

Solution 1:

This one-liner works for me:

while [[ $(findmnt /mnt) != "" ]]; do sudo umount /mnt; done

Explanation:

If the command findmnt /mnt produces non-empty output, something is mounted under /mnt. The test checks if the output is empty or not and if the output is not empty, we run umount /mnt once. If findmnt /mnt produces empty output, nothing is mounted under /mnt anymore and we are done.

If you run as root you can remove sudo from the line. If you run as normal user, you need sudo for the umount-command, but you need to enter your password only once.

Solution 2:

-A, --all-targets
  Unmount all mountpoints in the  current  namespace  for  the  specified
  filesystem.   The filesystem can be specified by one of the mountpoints
  or the device name (or UUID, etc.).  When this option is used  together
  with  --recursive,  then  all  nested  mounts within the filesystem are
  recursively unmounted.  This option is only supported on systems  where
  /etc/mtab is a symlink to /proc/mounts.

Is that maybe what you want? From man 8 umount.