[OpenAFS] Finding the 'mountpoint' of a volume

Turbo Fredriksson turbo@bayour.com
24 May 2002 13:57:46 +0200


>>>>> "Tino" == Tino Schwarze <tino.schwarze@informatik.tu-chemnitz.de> writes:

    Tino> Hi,
    Tino> On Fri, May 24, 2002 at 10:35:06AM +0200, Turbo Fredriksson wrote:
    >> I'm writing a script that let me easily backup a volume, but I
    >> need to know the exact mountpoint of the volume, so I can mount
    >> the backup volume inside 'VOLUME/OldFiles'...
    >> 
    >> vos examine don't give me this information...

    Tino> I see two ways of achieving what you want: 1. always create
    Tino> OldFiles (or name it BACKUP) in each volume and create the
    Tino> backup volume on volume creation time

This is what I'm trying to do. But to be able to 'create OldFiles in
each volume', I need to know WHERE the volume is!

    Tino> 2. just mount the
    Tino> volume somewhere temporary, create the mountpoint to BACKUP
    Tino> and unmount the volume again. (Yes, a volume can be mounted
    Tino> multiple times, wherever you want.)

The 'point' of HAVING OldFiles (or BACKUP if you prefere) is that it's
EASILY accessible. And where is easier than in the root of the volume!?


With a little shell hacking, I came up with this, close enough (for the
time beeing)...

----- s n i p -----
# --------------
# FUNCTION: Find the mountpoint of the volume
get_vol_mnt () {
    local vol="`echo $1 | sed 's@.*\.@@'`"
    local VOL

    MNTPOINT=`find /afs/$AFSCELL/ -type d -name '[a-zA-Z0-9]*' -exec find {} -type d -name "$vol" \;`

    # Double check that the mountpoint really IS the volume we're checking!
    VOL=`fs examine $MNTPOINT | head -n1 | sed 's@.* @@'`
    if [ ! "$VOL" = "$1" ]; then
	echo "Mountpoint and volume don't match. -> '$VOL != $1' ($MNTPOINT)"
	exit 1
    fi
}
----- s n i p -----
-- 
767 Ft. Meade Treasury CIA NORAD Uzi Semtex Clinton arrangements Rule
Psix Khaddafi toluene Albanian president ammunition
[See http://www.aclu.org/echelonwatch/index.html for more about this]