-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
109 lines (72 loc) · 2.88 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
gfid
----
This repository contains tools that assist in identifying
files/directories with mismatched gfid's on a GlusterFS backend.
Sample session
--------------
Let's say that you have a 4-node distribute-replicate cluster that has
inodes with mismatched gfid's. We'll assume the bricks are called:
/export/brick1
/export/brick2
/export/brick3
/export/brick4
It doesn't matter that these are on different machines. The tools in
this repository only work on file lists gathered (manually) from these
bricks.
The first step is to construct the master list of all files:
# cd /export/brick1
# find . > brick1.txt
# cd /export/brick2
# find . > brick2.txt
# cd /export/brick3
# find . > brick3.txt
# cd /export/brick4
# find . > brick4.txt
# cat brick1.txt brick2.txt brick3.txt brick4.txt | sort -u > master_list.txt
Then we need to get the gfid's of all the inodes from these bricks:
# cd /export/brick1
# gfid-list /path/to/master_list.txt > brick1.gfid
# cd /export/brick2
# gfid-list /path/to/master_list.txt > brick2.gfid
# cd /export/brick3
# gfid-list /path/to/master_list.txt > brick3.gfid
# cd /export/brick4
# gfid-list /path/to/master_list.txt > brick4.gfid
Now we're ready to identify the mismatched inodes:
# gfid-mismatch brick1.gfid brick2.gfid brick3.gfid brick4.gfid > mismatched.txt
This will generate the list of files with mismatched gfid's, one filename per line.
We can delete the gfid's now by doing:
# gluster volume stop <affected volume>
# cd /export/brick1
# gfid-delete /path/to/mismatched.txt
Repeat for the other bricks. `gfid-delete' will also produce a log
with one entry for each file, which is either:
usr/bin/factor: removed OK
OR
usr/bin/vim: No such file or directory
(or another error).
IMPORTANT NOTE: The deletion of gfid's must be done ONLY ON A STOPPED
VOLUME. Deleting the gfid's on a running volume with mounted clients
will cause more problems instead of solving them.
Verbose mode
------------
If you want to know details about the mismatch you can run:
# gfid-mismatch -v brick1.gfid brick2.gfid brick3.gfid brick4.gfid > mismatched.txt
This will produce output something like this:
usr/bin/factor: brick1.gfid brick2.gfid | brick3.gfid brick4.gfid
usr/bin/seq: brick1.gfid | brick3.gfid
[...]
The first line means that usr/bin/factor on brick1 and brick2 has the
same gfid which is different from the gfid on brick3 and brick4.
The second line means that the gfid of usr/bin/seq on brick1 is
different from that on brick3. brick2 and brick4 either don't have the
attribute or the inode doesn't exist on them.
Note that if you use the verbose mode you can't directly pass its
output to gfid-delete. You'll have to strip out everything except the
filename by doing:
# cat mismatched.txt | cut -f1 -d: > mismatched2.txt
However, beware that this will not work properly if the filenames
themselves contain the ':' character.
----
Vikas Gorur
http://github/vikasgorur