[linux-lvm] determining lv from mount point

Montgomery, Kendal L kendal.montgomery at qwest.com
Tue Sep 23 15:22:02 UTC 2003


The df command will already do that.  For instance, on my machine, if I do:

[klmontg at klmontg klmontg]$ df /opt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/vg01/opt          4194172   1610880   2583292  39% /opt

It gives me the filesystem, etc.

So, you could do something like this:

#!/bin/bash

if [[ ! -d ${1} ]]
then
  echo "error: ${1} is not a valid mount point"
  exit 1
fi

df ${1} | grep -v ^Filesystem | awk '{ print $1 }'

Kendal.

-----Original Message-----
From: Galen Seitz [mailto:galens at seitzassoc.com] 
Sent: Tuesday, September 23, 2003 3:28 PM
To: linux-lvm at sistina.com
Subject: [linux-lvm] determining lv from mount point



I'm trying to update my backup script (a tweaked version of hostdump.sh from
backupcentral.com) to use snapshots.  My machine has a mix of 
normal ext3 and ext3 on lvm filesystems.  What I'm looking for is an easy
way from a shell script to determine the lv from the mount point. The ideal
thing would be a shell function that takes the mount point as an argument
and returns the associated logical volume, or an error if the filesystem
doesn't use lvm.

Suggestions?

thanks,
galen

_______________________________________________
linux-lvm mailing list
linux-lvm at sistina.com http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/




More information about the linux-lvm mailing list