[Gluster-users] how to get hash range of a brick?

Ben Turner bturner at redhat.com
Thu Jul 24 20:51:27 UTC 2014

----- Original Message -----
> From: "david zhang700" <david.zhang700 at gmail.com>
> To: gluster-users at gluster.org
> Sent: Thursday, July 24, 2014 11:39:34 AM
> Subject: [Gluster-users] how to get hash range of a brick?
> hi,who can tell me how to get hash range of a brick? thank you!
> David

The command:

getfattr -n trusted.glusterfs.dht -e hex $brick

Will tell ya.  Run that on each brick.  IDK if this is useful but I keep a map of hash ranges when I do testing so I know where a file _should_ be:

    gluster volume info $volname | egrep '^Brick[0-9]+' |sed 's/: /=/' > /dev/shm/${volname}_brickinfo
    sed -i "s/^Brick/${volname}_Brick/g" /dev/shm/${volname}_brickinfo
    # Build hash range for bricks
    echo "Starting volume to populate xattrs"
    gluster v start $volname --mode=script
    sleep 5
    echo "Stopping volume"
    gluster v stop $volname --mode=script
    touch /dev/shm/${volname}_hashrange
    for line in $(/bin/cat /dev/shm/${volname}_brickinfo); do
        host=$(/bin/echo $line | /bin/cut -d '=' -f 2 | /bin/cut -d ':' -f 1)
        brick=$(/bin/echo $line | /bin/cut -d '=' -f 2 | /bin/cut -d ':' -f 2)
        range=$(ssh -i /root/.ssh/my_key $host "getfattr -n trusted.glusterfs.dht -e hex $brick")
        hash_range=$(/bin/echo $range | /bin/cut -d '=' -f 2 | /bin/sed 's/0x0000000100000000//g')
        begin_range=$(/bin/echo $hash_range | /bin/sed "s/$end_range//g")
        echo "${line}:${begin_range}:${end_range}" >> /dev/shm/${volname}_hashrange


> _______________________________________________
> Gluster-users mailing list
> Gluster-users at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-users

More information about the Gluster-users mailing list