[Gluster-users] Transforming server with existing data into a GlusterFS node

Anand Avati avati at zresearch.com
Tue Feb 10 09:38:44 UTC 2009


> Also I wrote a 'set-attrs' script for setting glusterfs attributes on
> existing data, essentially "converting" it to gluster format. Included
> below... It will ignore anything that already has glusterfs attributes, and
> will set them on anything that doesn't.
>
> #!/bin/bash
>
> DIR=$1
>
> if [ -z $DIR ]
>  then
>   echo
>   echo "Error - no path was given."
>   echo
>   echo  "USAGE:  set-attrs /path/to/check"
>   echo
>   echo  "Run set-attrs to check all files and directories in the"
>   echo  "given path for glusterfs attributes. Any files without"
>   echo  "a glusterfs version will be given a version attr of 2"
>   echo  "and a createtime attr equal to the files last modified time."
>   echo
>   echo  "Output information is logged to syslog (usually /var/log/messages)"
>   echo
>   exit 0
>  fi
>
> set_attrs()  {
>
> get_ver="getfattr --absolute-names -n trusted.glusterfs.version"
> set_ver="setfattr -n trusted.glusterfs.version"
> set_ct="setfattr -n trusted.glusterfs.createtime"
>
> if test "`$get_ver $i 2>/dev/null | fgrep -c trusted.glusterfs.version=`" =
> "0"
>  then
>    mods=$((mods+1))
>    # comment out next line to turn off logging
>    initlog -n set-attrs -s "Setting attrs on $i"
>    CT=`stat -c %Y $i`
>    $set_ct -v $CT $i
>    $set_ver -v 2 $i
>  fi
> }
>
> mods=0
> checks=0
>
> initlog -n set-attrs -s "Starting a set-attrs run on path: $DIR"
>
> for i in `find $DIR -print`
>  do
>    set_attrs $i
>    checks=$((checks+1))
>  done
>
> initlog -n set-attrs -s "Completed. $checks checks and $mods mods in this
> run"
>
> exit 0


This script is not needed in the latest AFR. In the latest AFR you do
not need any such script to get things started from an existing
backend.

Avati




More information about the Gluster-users mailing list