Re: How to identify a files shard?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sat, Apr 23, 2016 at 2:44 PM, Lindsay Mathieson <lindsay.mathieson@xxxxxxxxx> wrote:
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



1) Get the trusted.gfid extended attribute of the main file from the brick.

# getfattr -d -m . -e hex <path-to-the-file-on-the-brick>
For example:

# pwd
/bricks/3
# getfattr -d -m . -e hex file
# file: file
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a6574635f72756e74696d655f743a733000
trusted.afr.dirty=0x000000000000000000000000
trusted.bit-rot.version=0x0200000000000000571a0eae00016560
trusted.gfid=0xb577234394614334a397ecf8ee4ff75c

2) Convert the gfid into formatted string:
0xb577234394614334a397ecf8ee4ff75c ===> b5772343-9461-4334-a397-ecf8ee4ff75c

Alternatively from a fuse mount you could execute:
# getfattr -n glusterfs.gfid.string file
# file: file
glusterfs.gfid.string="b5772343-9461-4334-a397-ecf8ee4ff75c"

 
And how about the reverse? give a shard such as "007c8fcb-49ba-4e7e-b744-4e3768ac6bf6.1004" how would I indetify and locate the file it belongs to?

In the example you gave:
007c8fcb-49ba-4e7e-b744-4e3768ac6bf6 is the gfid of the original file.

1) On any of the replicas, do:
# stat $BRICK_ROOT/.glusterfs/00/7c/007c8fcb-49ba-4e7e-b744-4e3768ac6bf6
In the above example, '00' represents the first two characters of the gfid.
'7c' represents the next two characters.

2) Get the inode number from the stat output above.

3) On the brick root, execute:
# find . -inum <inode-number-gotten>

You'll see at least 2 paths listed for this inode number (because they're hardlinks of each other).
One of them is the .glusterfs/... path which is internally maintained by gluster.

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.

Thanks for asking. This is worth documenting. Will put up a .md soon.

-Krutika


 

--
Lindsay Mathieson

_______________________________________________
Gluster-users mailing list
Gluster-users@xxxxxxxxxxx
http://www.gluster.org/mailman/listinfo/gluster-users

_______________________________________________
Gluster-users mailing list
Gluster-users@xxxxxxxxxxx
http://www.gluster.org/mailman/listinfo/gluster-users

[Index of Archives]     [Gluster Development]     [Linux Filesytems Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux