Linux xfs文件系统修复

系统运行过程中,发现有一个分区上的服务经常挂掉,经检查发现是该分区磁盘有问题,尝试先进行修复。

首先,查看目前磁盘文件系统的类型

1
lsblk -f

显示出问题的分区/dev/sdb2的文件类型为xfs。通过搜索,了解到修复xfs文件类型的命令是xfs_repair。

接下来,把分区umount,再进行修复

1
2
3
4
5
6
7
8
9
10
11
umount /dev/sdb2
xfs_repair /dev/sdb2
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed. Mount the filesystem to replay the log, and unmount it before
re-running xfs_repair. If you are unable to mount the filesystem, then use
the -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.

出现错误信息,提示-L参数

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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
xfs_repair -L /dev/sdb2
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
- scan filesystem freespace and inode maps...
agi unlinked bucket 18 is 808210 in ag 3 (inode=202134802)
agi unlinked bucket 19 is 808211 in ag 3 (inode=202134803)
agi unlinked bucket 20 is 808212 in ag 3 (inode=202134804)
agi_freecount 1034, counted 965 in ag 0
agi_freecount 1108, counted 1077 in ag 1
sb_icount 235904, counted 193600
sb_ifree 157, counted 4695
sb_fdblocks 13037472, counted 30006537
- found root inode chunk
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
- process known inodes and perform inode discovery...
- agno = 0
imap claims a free inode 1315882 is in use, correcting imap and clearing inode
cleared inode 1315882
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
- agno = 1
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
data fork in ino 67729802 claims free block 16793674
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
data fork in ino 68120097 claims free block 16800677
correcting imap
correcting imap
- agno = 2
data fork in ino 134348835 claims free block 16793602
data fork in ino 134348836 claims free block 16793603
data fork in ino 134348837 claims free block 16793620
data fork in ino 134348848 claims free block 16793621
data fork in ino 134354888 claims free block 16794376
data fork in ino 134354889 claims free block 16794377
data fork in ino 134354900 claims free block 16794379
data fork in ino 134354901 claims free block 16794380
data fork in ino 134354903 claims free block 16794382
data fork in ino 134354904 claims free block 16794384
data fork in ino 134354905 claims free block 16794385
data fork in ino 134354913 claims free block 16794391
data fork in ino 134354915 claims free block 16794392
data fork in ino 134576159 claims free block 16822025
data fork in ino 134576160 claims free block 16822080
correcting imap
imap claims a free inode 134576190 is in use, correcting imap and clearing inode
cleared inode 134576190
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
data fork in ino 135090461 claims free block 16869397
data fork in ino 135090462 claims free block 16822264
data fork in ino 135090463 claims free block 16822265
data fork in ino 136142927 claims free block 17017872
data fork in ino 136142929 claims free block 17017875
data fork in ino 136142937 claims free block 17017877
data fork in ino 136142942 claims free block 17017884
data fork in ino 136142943 claims free block 17017850
data fork in ino 136142974 claims free block 17017886
data fork in ino 136142975 claims free block 17017887
- agno = 3
data fork in ino 201326712 claims free block 25166306
data fork in ino 201330710 claims free block 25234637
data fork in ino 201330710 claims free block 25234638
data fork in ino 201330710 claims free block 25255919
data fork in ino 201330710 claims free block 25255920
data fork in ino 201330711 claims free block 25166333
data fork in ino 201330717 claims free block 25166344
data fork in ino 201330739 claims free block 25166351
data fork in ino 201330740 claims free block 25166352
data fork in ino 201330741 claims free block 25166330
data fork in ino 201330742 claims free block 25166331
data fork in ino 201330748 claims free block 25166359
data fork in ino 201339387 claims free block 25166417
data fork in ino 201339387 claims free block 25166418
data fork in ino 201339387 claims free block 25166412
data fork in ino 201339387 claims free block 25166413
data fork in ino 201614134 claims free block 25234701
data fork in ino 201614134 claims free block 25234702
data fork in ino 201614142 claims free block 25189673
data fork in ino 201877963 claims free block 25234765
data fork in ino 201877970 claims free block 25234770
data fork in ino 201877971 claims free block 25234771
data fork in ino 202092034 claims free block 25261514
data fork in ino 202103948 claims free block 25263002
data fork in ino 202103977 claims free block 25263003
data fork in ino 202103981 claims free block 25263010
data fork in ino 202103993 claims free block 25263011
data fork in ino 202134758 claims free block 25266853
data fork in ino 202134766 claims free block 25266855
data fork in ino 202134767 claims free block 25266856
data fork in ino 202152321 claims free block 25269048
data fork in ino 202152327 claims free block 25269049
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
data fork in ino 202189808 claims free block 25273716
correcting imap
correcting imap
correcting imap
data fork in ino 202189811 claims free block 25273715
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
correcting imap
data fork in ino 202189837 claims free block 25273723
correcting imap
correcting imap
- process newly discovered inodes...
Phase 4 - check for duplicate blocks...
- setting up duplicate extent list...
- check for inodes claiming duplicate blocks...
- agno = 0
- agno = 3
- agno = 2
- agno = 1
entry "88d6b289ccdded63a0269106fa890f0e7881e794be56237a26c12f82526a8913" at block 0 offset 2736 in directory inode 67108928 references free inode 67729811
clearing inode number in entry at offset 2736...
entry "7179b8db08fba13d39245bf77de2003545bb4e8683694a25fa072fd5e5fb9836" at block 0 offset 2896 in directory inode 67108928 references free inode 202189829
clearing inode number in entry at offset 2896...
entry "592f9826ef5ab85244f517dd2eeb53347a39700c5e64c07d294f836a21735130-json.log" in shortform directory 134576187 references free inode 134576190
junking entry "592f9826ef5ab85244f517dd2eeb53347a39700c5e64c07d294f836a21735130-json.log" in directory inode 134576187
entry "work" in shortform directory 134577763 references free inode 2905207
junking entry "work" in directory inode 134577763
entry "22459eaba706000b51b7b974dee7c561e6eeb3a56b9927220592ee5bded0b535-json.log" in shortform directory 1169839 references free inode 1315882
junking entry "22459eaba706000b51b7b974dee7c561e6eeb3a56b9927220592ee5bded0b535-json.log" in directory inode 1169839
Phase 5 - rebuild AG headers and trees...
- reset superblock...
Phase 6 - check inode connectivity...
- resetting contents of realtime bitmap and summary inodes
- traversing filesystem ...
rebuilding directory inode 69
bad hash table for directory inode 67108928 (no data entry): rebuilding
rebuilding directory inode 67108928
rebuilding directory inode 201326657
- traversal finished ...
- moving disconnected inodes to lost+found ...
disconnected inode 1169840, moving to lost+found
disconnected inode 1315899, moving to lost+found
disconnected inode 1315926, moving to lost+found
disconnected inode 1315930, moving to lost+found
disconnected inode 1645283, moving to lost+found
disconnected inode 1645288, moving to lost+found
disconnected inode 1645292, moving to lost+found
disconnected dir inode 1645296, moving to lost+found
disconnected inode 1645297, moving to lost+found
disconnected inode 1645307, moving to lost+found
disconnected dir inode 1645319, moving to lost+found
disconnected inode 1645330, moving to lost+found
disconnected inode 1667323, moving to lost+found
disconnected inode 2905206, moving to lost+found
disconnected dir inode 2905208, moving to lost+found
disconnected dir inode 67653083, moving to lost+found
disconnected dir inode 67729778, moving to lost+found
disconnected inode 67729823, moving to lost+found
disconnected inode 68120096, moving to lost+found

disconnected dir inode 134576513, moving to lost+found
disconnected dir inode 134577760, moving to lost+found
disconnected dir inode 134577763, moving to lost+found
disconnected inode 202134802, moving to lost+found
disconnected inode 202134803, moving to lost+found
disconnected inode 202134804, moving to lost+found
disconnected dir inode 202152356, moving to lost+found
disconnected dir inode 202152366, moving to lost+found
disconnected inode 202189837, moving to lost+found
Phase 7 - verify and correct link counts...
resetting inode 67108928 nlinks from 112 to 110
resetting inode 201326657 nlinks from 510 to 514
resetting inode 134577763 nlinks from 5 to 4
resetting inode 1315882 nlinks from 2 to 12
Maximum metadata LSN (301:105894) is ahead of log (1:2).
Format log to cycle 304.
done
作者

ovasty

发布于

2021-02-27

更新于

2021-02-27

许可协议

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.