<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 23, 2016 at 2:44 PM, Lindsay Mathieson <span dir="ltr">&lt;<a href="mailto:lindsay.mathieson@gmail.com" target="_blank">lindsay.mathieson@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Give a file on a volume how do I identify it shards? it looks to be like a uuid for the file with a .xxx extension<br>
<br>
<br></blockquote><div><br></div><div>1) Get the trusted.gfid extended attribute of the main file from the brick.<br><br></div><div># getfattr -d -m . -e hex &lt;path-to-the-file-on-the-brick&gt;<br></div><div>For example:<br><br># pwd<br>/bricks/3<br># getfattr -d -m . -e hex file <br># file: file<br>security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a6574635f72756e74696d655f743a733000<br>trusted.afr.dirty=0x000000000000000000000000<br>trusted.bit-rot.version=0x0200000000000000571a0eae00016560<br>trusted.gfid=0xb577234394614334a397ecf8ee4ff75c<br><br></div><div>2) Convert the gfid into formatted string:<br>0xb577234394614334a397ecf8ee4ff75c ===&gt; b5772343-9461-4334-a397-ecf8ee4ff75c<br><br></div><div>Alternatively from a fuse mount you could execute:<br># getfattr -n glusterfs.gfid.string file<br># file: file<br>glusterfs.gfid.string=&quot;b5772343-9461-4334-a397-ecf8ee4ff75c&quot;<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
And how about the reverse? give a shard such as &quot;007c8fcb-49ba-4e7e-b744-4e3768ac6bf6.1004&quot; how would I indetify and locate the file it belongs to?<span><font color="#888888"><br></font></span></blockquote><div><br></div><div>In the example you gave:<br>007c8fcb-49ba-4e7e-b744-4e3768ac6bf6 is the gfid of the original file.<br></div><div><br></div><div>1) On any of the replicas, do:<br></div><div># stat $BRICK_ROOT/.glusterfs/00/7c/007c8fcb-49ba-4e7e-b744-4e3768ac6bf6<br></div><div>In the above example, &#39;00&#39; represents the first two characters of the gfid.<br></div><div>&#39;7c&#39; represents the next two characters.<br><br></div><div>2) Get the inode number from the stat output above.<br><br></div><div>3) On the brick root, execute:<br></div><div># find . -inum &lt;inode-number-gotten&gt;<br></div><div><br></div><div>You&#39;ll see at least 2 paths listed for this inode number (because they&#39;re hardlinks of each other).<br></div><div>One of them is the .glusterfs/... path which is internally maintained by gluster.<br><br></div><div>The other path (or paths if the application itself created hard links to this file) is the one belonging to the main file that this shard belongs to.<br><br></div><div>Thanks for asking. This is worth documenting. Will put up a .md soon.<br></div><div><br></div><div>-Krutika<br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><font color="#888888">
<br>
-- <br>
Lindsay Mathieson<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://www.gluster.org/mailman/listinfo/gluster-users" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-users</a><br>
</font></span></blockquote></div><br></div></div>