Finding partition containing a path?

S

skip

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,789
Messages
2,569,634
Members
45,342
Latest member
Sicuro

Latest Threads

Top