Finding partition containing a path?

skip at pobox.com skip at pobox.com
Fri Apr 24 17:13:29 EDT 2009


This little shell script lists the partitions containing /var/opt on a set
of hosts:

    for h in host1 host2 host3 ; do
      echo -n "$h "
      ssh $h df -h /var/opt | egrep -v '^Filesystem' | awk '{print $6}'
    done

producing output like this:

    host1 /var/opt
    host2 /var/opt
    host3 /

Is there an easy way in Python to get the mount point in which a path
resides?  (Unix only is fine.)

Thanks,

-- 
Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/
        "XML sucks, dictionaries rock" - Dave Beazley



More information about the Python-list mailing list