Mittwoch, 26. März 2014

Get rid of T---- files in glusterfs

If you had a bad performance on the Glusterfs it could be due to the wrong location of the files.
If brick was off-line then file goes to another one.
After bringing back the brick the files are still in the wrong place. Glusterfs generates zero size T---- attribute file to show where the file is.

Find Bad files on a brick and move them back correctly.

Warning this should be done if you have a backup. You may remove or delete important files be careful!

In order to make file move correctly better to work with glusterfs mount point.

 Let us see by example: Assuming /store/01 and /store/02 are the bricks and
/store/glu is mount point of the GluFS.

  • find /store/01 /store/02 -type f -perm 1000| tee /tmp/bad-Tfiles.log
  • cat /tmp/bad-Tfiles.log| sed -r 's/\/store\/0+[1-4]/\/store\/0\?/g'| xargs -I{} echo ls -l {}| parallel | tee /tmp/results.log
If we have duplicate files with same name but one is T--- and another normal file we should remove T--- file and move good file to gluster using glufs mount point: unlink /store/01/file.txt;mv /store/02/file.txt /tmp/;mv /tmp/file.txt /store/glu Now if we do:ls -l /store/0?/file.txt We should see only one file name.