<html><head><style type='text/css'>p { margin: 0; }</style><style type='text/css'>body { font-family: 'Times New Roman'; font-size: 12pt; color: #000000}</style></head><body>Hi - I wrote a script to set attributes on pre-existing data, but I have done very little testing with it so far. If you want to try it out it might save you some manual labor. After some more testing I was going to post it to the list and the wiki but it looks like you might be able to use it now... It works and it seems safe enough as it doesn't do anything but add gluster attributes to files which don't have any. Let me know if it works for you, and if anyone has any suggestions for improvement. <br><br>Thanks, <br>Chris <br><br>#!/bin/bash<br><br>DIR=$1<br><br>if [ -z $DIR ]<br>&nbsp;then<br>&nbsp;&nbsp;echo<br>&nbsp;&nbsp;echo "Error - no path was given."<br>&nbsp;&nbsp;echo<br>&nbsp;&nbsp;echo &nbsp;"USAGE: &nbsp;set-attrs /path/to/check"<br>&nbsp;&nbsp;echo<br>&nbsp;&nbsp;echo &nbsp;"Run set-attrs to check all files and directories in the"<br>&nbsp;&nbsp;echo &nbsp;"given path for glusterfs attributes. Any files without"<br>&nbsp;&nbsp;echo &nbsp;"a glusterfs version will be given a version attr of 2"<br>&nbsp;&nbsp;echo &nbsp;"and a createtime attr equal to the files last modified time."<br>&nbsp;&nbsp;echo<br>&nbsp;&nbsp;echo &nbsp;"Output information is logged to syslog (usually /var/log/messages)"<br>&nbsp;&nbsp;echo<br>&nbsp;&nbsp;exit 0<br>&nbsp;fi<br><br>set_attrs() &nbsp;{<br><br>get_ver="getfattr --absolute-names -n trusted.glusterfs.version"<br>set_ver="setfattr -n trusted.glusterfs.version"<br>set_ct="setfattr -n trusted.glusterfs.createtime"<br><br>if test "`$get_ver $i 2&gt;/dev/null | fgrep -c trusted.glusterfs.version=`" = "0"<br>&nbsp;then<br>&nbsp;&nbsp; mods=$((mods+1))<br>&nbsp;&nbsp; # comment out next line to turn off logging<br>&nbsp;&nbsp; initlog -n set-attrs -s "Setting attrs on $i"<br>&nbsp;&nbsp; CT=`stat -c %Y $i`<br>&nbsp;&nbsp; $set_ct -v $CT $i<br>&nbsp;&nbsp; $set_ver -v 2 $i<br>&nbsp;fi<br>}<br><br>mods=0<br>checks=0<br><br>initlog -n watch-dir -s "Starting a set-attrs run on path: $DIR"<br><br>for i in `find $DIR -print`<br>&nbsp;do<br>&nbsp;&nbsp; set_attrs $i<br>&nbsp;&nbsp; checks=$((checks+1))<br>&nbsp;done<br><br>initlog -n watch-dir -s "Completed. $checks checks and $mods mods in this run"<br><br>exit 0<br><br>----- Original Message -----<br>From: "baggio liu" &lt;baggioss@gmail.com&gt;<br>To: "Keith Freedman" &lt;freedman@freeformit.com&gt;, gluster-users@gluster.org<br>Sent: Wednesday, July 23, 2008 2:47:01 AM GMT -05:00 US/Canada Eastern<br>Subject: Re: [Gluster-users] Unify over AFR with pre-existing data<br><br><div dir="ltr">Hi ,<br>&nbsp;&nbsp;&nbsp; thanks for reply. And pls see my comment inline. And&nbsp; question is still pending. has any <span class="related_definition"><bdo>more grace<span class="comment"> way</span></bdo></span> to fix this issue?? <br>
<br>Regards<br>Baggio<br><br><br><br><br><div class="gmail_quote">2008/7/23 Keith Freedman &lt;<a href="mailto:freedman@freeformit.com" target="_blank">freedman@freeformit.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I had 2 situations with pre-existing data and I solved the both 2 different ways.<br>
<br>
1), I followed the instructions in the link provided, however, I was running xfs on the underlying filesystem and so the command to add attributes is different.<br>
in this case, it's attr instead of setfattr to set the extended attribute. &nbsp;Also, I *think* the actual attribute name is different.</blockquote><div>&nbsp;&nbsp; <br><span style="color: rgb(0, 0, 153);">&nbsp;&nbsp; The extension attr names are hard-code , so it should not change according to underlying fs.</span><br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
so, what I recommend is to create one file through gluster, view it's extended attributes through the base filesystem then apply those to the remaining files.<br>
<br>
2) This is the less friendly but more surefire solution:<br>
make the gluster source point a sub directory in the source filesystem.<br>
then "move" the files into the gluster filesystem.<br>
This is less handy for "live" data, but it does insure the existing data is properly "glustered"</blockquote><div>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 153);">This way can make data right, but too many extra cost has been involved. In our plan, hundreds of TB should be stored in this fs , This loop may cost several days . So it can not be tolerated.</span><br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
here's what I did:<br>
CURRENT SOURCE: /home<br>
GLUSTER SOURCE /home/home<br>
GLUSTER MOUNT POINT /gluster/home<br>
<br>
(this may not be syntatically correct):<br>
cd /home<br>
for i in *<br>
do<br>
if [ $i != 'glusterhome' ]<br>
 &nbsp;mv $i glusterhome<br>
 &nbsp;ln -s gluster/home/$i $i<br>
fi<br>
<br>
then unmount /gluster/home, unmount /home &nbsp; remount /home on /gluster<br>
now you have /gluster/home with your data which has the gluster attributes attached.<br>
mount glusterfs from /gluster/home &nbsp;to /home<br>
<br>
I actually used this second procedure &nbsp;to get the data onto my new AFR mirror. &nbsp;It slowed the process down since it was replicating 50GB of data while moving it form disk to disk, but I'm not sure it slowed it down much. &nbsp;</blockquote>
<div><br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">it seems to really mostly just reduce disk thrashing and my copy was going at near network speed.</blockquote>
<div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;&nbsp; BTW, I'm not very clear of it, Could you explain in detail? or list some example, test result, and so on. thx</span><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Keith<div class="Ih2E3d"><br>
At 07:11 PM 7/22/2008, baggio liu wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Hi guys,<br>
 &nbsp; I have configured a cluster with unify over afr. one of server in afr has some pre-existing &nbsp;data. &nbsp;And I want to make these data can be seen by client.<br>
 &nbsp; Some &nbsp;config have been done according to<br>
 &nbsp; &nbsp; &nbsp;"Setting up AFR on two servers with pre-existing data"<br>
<br></div>
&lt;<a href="http://gluster.org/docs/index.php/Setting_up_AFR_on_two_servers_with_pre-existing_data" target="_blank">http://gluster.org/docs/index.php/Setting_up_AFR_on_two_servers_with_pre-existing_data</a>&gt;<a href="http://gluster.org/docs/index.php/Setting_up_AFR_on_two_servers_with_pre-existing_data" target="_blank">http://gluster.org/docs/index.php/Setting_up_AFR_on_two_servers_with_pre-existing_data</a><div class="Ih2E3d">
<br>
 &nbsp; But namespace can not aware with those data.<br>
 &nbsp; After afr completing, ls at client , pre-existing &nbsp;data can not be seen. cat &nbsp;them, Input/output error can be found.<br>
<br>
<br>
 &nbsp; What should I fix them? Thank you for any help.<br>
<br>
Regards<br>
Baggio<br></div>
_______________________________________________<br>
Gluster-users mailing list<br>
<a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.org</a><br>
<a href="http://zresearch.com/cgi-bin/mailman/listinfo/gluster-users" target="_blank">http://zresearch.com/cgi-bin/mailman/listinfo/gluster-users</a><br>
</blockquote>
<br>
</blockquote></div><br></div>
<br>_______________________________________________
Gluster-users mailing list
Gluster-users@gluster.org
http://zresearch.com/cgi-bin/mailman/listinfo/gluster-users
</body></html>