GlusterFS
GlusterFS 文件系统
Glusterfs中,在brick对应的path下,有一个 .glusterfs 文件夹,其中保存了相应文件的gfid
比如 gfid 是 b742668a-92e7-4aaf-9f53-331f97d6da58 则对应目录为 .glusterfs/b7/42,一级目录 b7 对应gfid的1-2位,二级目录 42 对应gfid的3-4位
ls -i
64487430 b742668a-92e7-4aaf-9f53-331f97d6da58
解析gfid对应文件的sh脚本
解析 gfid 对应的文件
https://gist.github.com/louiszuckerman/4392640
gfid-resolver.sh
#!/bin/bash
if [[ "$#" < "2" || "$#" > "3" ]]; then
cat <<END
Glusterfs GFID resolver -- turns a GFID into a real file path
Usage: $0 <brick-path> <gfid> [-q]
<brick-path> : the path to your glusterfs brick (required)
<gfid> : the gfid you wish to resolve to a real path (required)
-q : quieter output (optional)
with this option only the actual resolved path is printed.
without this option $0 will print the GFID,
whether it identifies a file or directory, and the resolved
path to the real file or directory.
Theory:
The .glusterfs directory in the brick root has files named by GFIDs
If the GFID identifies a directory, then this file is a symlink to the
actual directory. If the GFID identifies a file then this file is a
hard link to the actual file.
END
exit
fi
BRICK="$1"
GFID="$2"
GP1=`cut -c 1-2 <<<"$GFID"`
GP2=`cut -c 3-4 <<<"$GFID"`
GFIDPRE="$BRICK"/.glusterfs/"$GP1"/"$GP2"
GFIDPATH="$GFIDPRE"/"$GFID"
if [[ "$#" == "2" ]]; then
echo -ne "$GFID\t==\t"
fi
if [[ -h "$GFIDPATH" ]]; then
if [[ "$#" == "2" ]]; then
echo -ne "Directory:\t"
fi
DIRPATH="$GFIDPRE"/`readlink "$GFIDPATH"`
echo $(cd $(dirname "$DIRPATH"); pwd -P)/$(basename "$DIRPATH")
else
if [[ "$#" == "2" ]]; then
echo -ne "File:\t"
fi
INUM=`ls -i "$GFIDPATH" | cut -f 1 -d \ `
find "$BRICK" -inum "$INUM" ! -path \*.glusterfs/\*
fi
上一篇 Scrapy 爬虫
页面信息
location:
protocol
: host
: hostname
: origin
: pathname
: href
: document:
referrer
: navigator:
platform
: userAgent
: