def is_mounted(src, mount_point, fstype, perm=None, verbose=True, fstype_mtab=None):
 if (perm is None):
  perm = ''
 if (fstype_mtab is None):
  fstype_mtab = fstype
 mount_point = os.path.realpath(mount_point)
 if (fstype not in ['nfs', 'smbfs', 'glusterfs', 'hugetlbfs', 'ubifs']):
  if src:
   src = os.path.realpath(src)
  else:
   src = ''
 mount_string = ('%s %s %s %s' % (src, mount_point, fstype_mtab, perm))
 if (mount_string.strip() in file('/etc/mtab').read()):
  logging.debug('%s is successfully mounted', src)
  return True
 else:
  if verbose:
   logging.error("Can't find mounted NFS share - /etc/mtab contents \n%s", file('/etc/mtab').read())
  return False

def is_mounted ( src , mount_point , fstype , perm = None , verbose = True , fstype_mtab = None ) : if ( perm is None ) : perm = '' if ( fstype_mtab is None ) : fstype_mtab = fstype mount_point = os . path . realpath ( mount_point ) if ( fstype not in [ 'nfs' , 'smbfs' , 'glusterfs' , 'hugetlbfs' , 'ubifs' ] ) : if src : src = os . path . realpath ( src ) else : src = '' mount_string = ( '%s %s %s %s' % ( src , mount_point , fstype_mtab , perm ) ) if ( mount_string . strip ( ) in file ( '/etc/mtab' ) . read ( ) ) : logging . debug ( '%s is successfully mounted' , src ) return True else : if verbose : logging . error ( "Can't find mounted NFS share - /etc/mtab contents \n%s" , file ( '/etc/mtab' ) . read ( ) ) return False
check mount status from /etc/mtab .