Skip to content

Instantly share code, notes, and snippets.

@aravindavk
Last active December 14, 2015 23:09
Show Gist options
  • Save aravindavk/5163516 to your computer and use it in GitHub Desktop.
Save aravindavk/5163516 to your computer and use it in GitHub Desktop.
glusterfs adds 'trusted.gfid' as extended attribute to the files and creates hard link to that file in .glusterfs directory. This script accepts gfid as parameter and finds respective file in system.
#!/bin/bash
# glusterfs adds 'trusted.gfid' as extended attribute to the files
# and creates hard link to that file in .glusterfs directory
# This script accepts gfid as parameter and finds respective file in
# system
# Example Usage:
# ./file-by-gfid f6b2307a-8d3f-4e61-94eb-c565f48240fb
META_DIR=.glusterfs/
function main()
{
gfid=$1;
to_search=$META_DIR${gfid:0:2}"/"${gfid:2:2}"/"$gfid;
find . -samefile $to_search | grep -v $to_search;
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment