Since not all nodes in our system has a namespace directory I had to use NFS to create the namespace files and directories from those nodes. I also did not create directories on the bricks; these were all good on our system. So I ended up with this slighly modified version of the script:<br>
<br>#!/bin/bash<br><br># Script for restoring the namespace of a GlusterFS node<br>#<br># By hypobyte for Jotta AS<br># No rights reserved<br>#<br><br>MOUNT=/mnt/<br>NS=~/ns/<br>DRIVES=(data01 data02)<br><br>TOTAL_FILES=0<br>
TOTAL_DIRS=0<br><br># Builds the namespace for a drive<br>function restore() {<br>    echo &quot;Restoring drive $1 to $NS&quot;<br>    FILES=0<br>    DIRS=0<br>    for path in `find $1`; do<br>        # Remove the root  path from the filename<br>
        file=$NS${path#*$1/}<br>        if test -d $path; then<br>            #echo &quot;Restoring directory $path to $file&quot;<br>            mkdir -p &quot;$file&quot;<br>            DIRS=$(($DIRS+1))<br>        else<br>
            #echo &quot;Restoring file $path to $file&quot;<br>            touch --reference=&quot;$path&quot; &quot;$file&quot;<br>            FILES=$(($FILES+1))<br>        fi<br>    done<br>    echo &quot;Restored $FILES files and $DIRS directories from $1&quot;<br>
    TOTAL_FILES=$(($TOTAL_FILES+$FILES))<br>    TOTAL_DIRS=$(($TOTAL_DIRS+$DIRS))<br>}<br><br>for drive in ${DRIVES[@]}; do<br>    restore &quot;$MOUNT$drive&quot;<br>done<br><br>echo &quot;Finished namespace restore of $TOTAL_FILES files and $TOTAL_DIRS directories&quot;<br>
<br>I then used the &quot;ls -lR&quot; command to trigger self-healing of the FS. This copied the new namespace to the replicated namespace node, and seems to have restored data correctly where it should. I did get a lot of these errors on the servers during self-heal:<br>
<br>[2009-06-26 18:26:29] E [server-protocol.c:6387:server_setdents] server: fd - 0 (55697410): received a null buffer, returning EINVAL<br><br>Not sure if that is something I need to worry about. AFAICT everything is fine now.<br>
<br>Thanks for your help!<br><br>Trygve<br><br><div class="gmail_quote">
On Fri, Jun 26, 2009 at 2:17 PM, Trygve Hardersen <span dir="ltr">&lt;<a href="mailto:trygve@jotta.no" target="_blank">trygve@jotta.no</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Thanks, I&#39;ll try this.<br><font color="#888888"><br>Trygve</font><div><div></div><div><br><br><div class="gmail_quote">On Fri, Jun 26, 2009 at 2:02 PM, David Saez Padros <span dir="ltr">&lt;<a href="mailto:david@ols.es" target="_blank">david@ols.es</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
<br>
In our case the unify volume appears completly empty altough the<br>
disks have data, also the server log shows some lines about activating<br>
auto-heal but nothing happens, so we have build a script to populate<br>
the namespace, in our case we have a folder that contains a subfolder<br>
named &#39;namespace&#39; and 6 subfolders named 1 to 6 where each one is a<br>
brick of the unify volume, then running this on the main folder<br>
populates the namespace and creates appropiate folders in all bricks:<br>
<br>
#!/bin/bash<br>
<br>
for disk in 1 2 3 4 5 6 ; do<br>
for file in `find $disk`; do<br>
        rel=${file#*/}<br>
        if test -d $file ; then<br>
                mkdir -p namespace/$rel<br>
                for dsk in 1 2 3 4 5 6 ; do<br>
                        mkdir -p $dsk/$rel<br>
                done<br>
        else<br>
                touch --reference=$file namespace/$rel<br>
        fi<br>
done<br>
done<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
Hi<br>
<br>
We have a similar problem. Our file system became unusable for some reason. It seems to me like GlusterFS believes that files are present on some nodes when they really are not. I want to try to regenerate the namespace from the data that is actually present on the nodes.<br>



<br>
Does anyone have information about how that can be achieved? Somewhere I read that:<br>
<br>
Namespace does not hold any crucial data, it is just like a cache. Infact you can wipe our your namespace anytime and it will rebuild again.<br>
<br>
Thanks for your help<br>
<br>
Trygve Hardersen<br>
Jotta AS<br>
<br></div><div>
On Tue, Jun 23, 2009 at 12:11 PM, David Saez Padros &lt;<a href="mailto:david@ols.es" target="_blank">david@ols.es</a> &lt;mailto:<a href="mailto:david@ols.es" target="_blank">david@ols.es</a>&gt;&gt; wrote:<br>
<br>
    Hi<br>
<br>
    i have setup a unify volume using glusterfs 2.0.1 using several<br>
    disks with existing data, but once mounted in the remote client<br>
    the volume appears empty where it was suposed to auto-heal it&#39;s<br>
    contents automatically, is there any way to automatically<br>
    generate the namespace so existing data is visible to clients ?<br>
<br>
    --     Thanx &amp; best regards ...<br>
<br>
    ----------------------------------------------------------------<br>
      David Saez Padros                <a href="http://www.ols.es" target="_blank">http://www.ols.es</a><br>
      On-Line Services 2000 S.L.       telf    +34 902 50 29 75<br>
    ----------------------------------------------------------------<br>
<br>
<br>
<br>
    _______________________________________________<br>
    Gluster-users mailing list<br></div>
    <a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.org</a> &lt;mailto:<a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.org</a>&gt;<div><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>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div><br>
<br>
_______________________________________________<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>
</div></blockquote><font color="#888888">
<br>
-- <br>
Salu-2 y hasta pronto ...</font><div><div></div><div><br>
<br>
----------------------------------------------------------------<br>
   David Saez Padros                <a href="http://www.ols.es" target="_blank">http://www.ols.es</a><br>
   On-Line Services 2000 S.L.       telf    +34 902 50 29 75<br>
----------------------------------------------------------------<br>
<br>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>