While trying to rebuild a volume from scratch this morning I started running into issues when my new bricks were named the same thing as my old bricks. Specifically, I was receiving a message stating “volume create: images: failed: [path to brick] is already part of a volume.” These new bricks were empty and were just using the same path and name as the old bricks (which had been moved to a backup drive for safe keeping). Turns out that there were a few attributes that needed to be removed before being able to add the bricks into a volume that were designed as a safe guard. With the warning that you need to think hard about what you are doing before actually performing these steps, here are the steps that I took to clear the attributes for the brick:
This command removed the trusted.glusterfs.volume-id attribute.
setfattr -x trusted.glusterfs.volume-id [path to brick]
This command removes the trusted.gfid attribute. Don’t worry if this attribute does not exist (it didn’t for me).
setfattr -x trusted.gfid [path to brick]
This command removes the .glusterfs directory inside of the brick directory. In my case it was not needed because the original directories were moved but if the directory is truly being re-used this will clean things up.
rm -rf [path to brick]/.glusterfs
After running these commands I restarted the glusterd service to make sure nothing was being remembered and then successfully added and started my new volume.