Closed someone-somenet-org closed 10 months ago
What is the actual output of filefrag -vb1 pathA
and filefrag -vb1 pathB
? Note that small files cannot be deduplicated via reflinks because they have inline extents. (Although in this case, they appear to be sufficiently large.)
pathA
Filesystem type is: 9123683e
File size of pathA is 25021930 (25022464 blocks of 1 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 8122367: 3119203209216..3119211331583: 8122368: shared
1: 8126464.. 8163327: 3104252211200..3104252248063: 36864: 3119211335680: encoded,shared
2: 8183808.. 8212479: 3104252227584..3104252256255: 28672: 3104252268544: encoded,shared
3: 8548352.. 8679423: 3104252243968..3104252375039: 131072: 3104252592128: encoded,shared
4: 8679424.. 9596927: 3119211331584..3119212249087: 917504: 3104252375040: shared
5: 9596928.. 9727999: 3104252329984..3104252461055: 131072: 3119212249088: encoded,shared
6: 9728000..10645503: 3119212249088..3119213166591: 917504: 3104252461056: shared
7: 10645504..10776575: 3104252432384..3104252563455: 131072: 3119213166592: encoded,shared
8: 10776576..10907647: 3104252538880..3104252669951: 131072: 3104252563456: encoded,shared
9: 10907648..11038719: 3104252641280..3104252772351: 131072: 3104252669952: encoded,shared
10: 11038720..11169791: 3104252743680..3104252874751: 131072: 3104252772352: encoded,shared
11: 11169792..11300863: 3104252846080..3104252977151: 131072: 3104252874752: encoded,shared
12: 11300864..11431935: 3104252952576..3104253083647: 131072: 3104252977152: encoded,shared
13: 11431936..11563007: 3104253054976..3104253186047: 131072: 3104253083648: encoded,shared
14: 11563008..11694079: 3104253161472..3104253292543: 131072: 3104253186048: encoded,shared
15: 11694080..11825151: 3104253267968..3104253399039: 131072: 3104253292544: encoded,shared
16: 11825152..12742655: 3119213166592..3119214084095: 917504: 3104253399040: shared
17: 12742656..12873727: 3104253374464..3104253505535: 131072: 3119214084096: encoded,shared
18: 12873728..13266943: 3119214084096..3119214477311: 393216: 3104253505536: shared
19: 13266944..13398015: 3104253476864..3104253607935: 131072: 3119214477312: encoded,shared
20: 13398016..13529087: 3104253583360..3104253714431: 131072: 3104253607936: encoded,shared
21: 13529088..13660159: 3104253689856..3104253820927: 131072: 3104253714432: encoded,shared
22: 13660160..13791231: 3104253796352..3104253927423: 131072: 3104253820928: encoded,shared
23: 13791232..13922303: 3104253902848..3104254033919: 131072: 3104253927424: encoded,shared
24: 13922304..14053375: 3104254013440..3104254144511: 131072: 3104254033920: encoded,shared
25: 14053376..14315519: 3119214477312..3119214739455: 262144: 3104254144512: shared
26: 14315520..14446591: 3104254119936..3104254251007: 131072: 3119214739456: encoded,shared
27: 14446592..14577663: 3104254226432..3104254357503: 131072: 3104254251008: encoded,shared
28: 14577664..14708735: 3104254332928..3104254463999: 131072: 3104254357504: encoded,shared
29: 14708736..14839807: 3104254418944..3104254550015: 131072: 3104254464000: shared
30: 14839808..14950399: 3104254550016..3104254660607: 110592: encoded,shared
31: 14958592..14962687: 3104254631936..3104254636031: 4096: 3104254668800: shared
32: 14966784..14999551: 3104254636032..3104254668799: 32768: encoded,shared
33: 15007744..15011839: 3104254648320..3104254652415: 4096: 3104254676992: shared
34: 15020032..15024127: 3104254652416..3104254656511: 4096: shared
35: 15036416..15060991: 3104254656512..3104254681087: 24576: encoded,shared
36: 15065088..15077375: 3104254660608..3104254672895: 12288: 3104254685184: encoded,shared
37: 15085568..15089663: 3104254668800..3104254672895: 4096: 3104254681088: shared
38: 15110144..15122431: 3104254672896..3104254685183: 12288: encoded,shared
39: 15151104..15155199: 3104254676992..3104254681087: 4096: 3104254713856: shared
40: 15171584..15228927: 3104254681088..3104254738431: 57344: encoded,shared
41: 15233024..15347711: 3104254705664..3104254820351: 114688: 3104254742528: encoded,shared
42: 15351808..15482879: 3104254750720..3104254881791: 131072: 3104254824448: encoded,shared
43: 15482880..15613951: 3104254808064..3104254939135: 131072: 3104254881792: encoded,shared
44: 15613952..15745023: 3104254865408..3104254996479: 131072: 3104254939136: encoded,shared
45: 15745024..15876095: 3104254922752..3104255053823: 131072: 3104254996480: encoded,shared
46: 15876096..16007167: 3104254980096..3104255111167: 131072: 3104255053824: encoded,shared
47: 16007168..16138239: 3104255037440..3104255168511: 131072: 3104255111168: encoded,shared
48: 16138240..16269311: 3104255102976..3104255234047: 131072: 3104255168512: encoded,shared
49: 16269312..16400383: 3104255188992..3104255320063: 131072: 3104255234048: encoded,shared
50: 16400384..16531455: 3104255270912..3104255401983: 131072: 3104255320064: encoded,shared
51: 16531456..16662527: 3104255361024..3104255492095: 131072: 3104255401984: encoded,shared
52: 16662528..16793599: 3104255451136..3104255582207: 131072: 3104255492096: encoded,shared
53: 16793600..16924671: 3104255537152..3104255668223: 131072: 3104255582208: encoded,shared
54: 16924672..17055743: 3104255614976..3104255746047: 131072: 3104255668224: encoded,shared
55: 17055744..17092607: 3104255709184..3104255746047: 36864: 3104255746048: shared
56: 17121280..17145855: 3104255746048..3104255770623: 24576: shared
57: 17154048..17285119: 3104255770624..3104255901695: 131072: encoded,shared
58: 17285120..17334271: 3104255868928..3104255918079: 49152: 3104255901696: encoded,shared
59: 17338368..17362943: 3104255897600..3104255922175: 24576: 3104255922176: encoded,shared
60: 17367040..17465343: 3104255909888..3104256008191: 98304: 3104255926272: encoded,shared
61: 17469440..17600511: 3104255967232..3104256098303: 131072: 3104256012288: encoded,shared
62: 17600512..17723391: 3104256053248..3104256176127: 122880: 3104256098304: encoded,shared
63: 17727488..17858559: 3104256139264..3104256270335: 131072: 3104256180224: encoded,shared
64: 17858560..17879039: 3104256225280..3104256245759: 20480: 3104256270336: shared
65: 17948672..17977343: 3104256245760..3104256274431: 28672: shared
66: 17989632..18010111: 3104256274432..3104256294911: 20480: shared
67: 18022400..18153471: 3104256294912..3104256425983: 131072: encoded,shared
68: 18153472..18284543: 3104256380928..3104256511999: 131072: 3104256425984: encoded,shared
69: 18284544..18415615: 3104256462848..3104256593919: 131072: 3104256512000: encoded,shared
70: 18415616..18419711: 3104256548864..3104256552959: 4096: 3104256593920: shared
71: 18423808..18468863: 3104256552960..3104256598015: 45056: encoded,shared
72: 18472960..19275775: 3119214739456..3119215542271: 802816: 3104256602112: shared
73: 19288064..19308543: 3104256577536..3104256598015: 20480: 3119215554560: encoded,shared
74: 19365888..19496959: 3104256581632..3104256712703: 131072: 3104256655360: encoded,shared
75: 19496960..19542015: 3104256618496..3104256663551: 45056: 3104256712704: encoded,shared
76: 19595264..19726335: 3104256634880..3104256765951: 131072: 3104256716800: encoded,shared
77: 19726336..19836927: 3104256712704..3104256823295: 110592: 3104256765952: encoded,shared
78: 19931136..19939327: 3104256786432..3104256794623: 8192: 3104256917504: encoded,shared
79: 19943424..19988479: 3104256790528..3104256835583: 45056: 3104256798720: encoded,shared
80: 19992576..20123647: 3104256794624..3104256925695: 131072: 3104256839680: encoded,shared
81: 20123648..20254719: 3104256798720..3104256929791: 131072: 3104256925696: encoded,shared
82: 20254720..20385791: 3104256806912..3104256937983: 131072: 3104256929792: encoded,shared
83: 20385792..20516863: 3104256815104..3104256946175: 131072: 3104256937984: encoded,shared
84: 20516864..20647935: 3104256823296..3104256954367: 131072: 3104256946176: encoded,shared
85: 20647936..20721663: 3104256831488..3104256905215: 73728: 3104256954368: encoded,shared
86: 22740992..22872063: 3104256835584..3104256966655: 131072: 3104258924544: encoded,shared
87: 22872064..23003135: 3104256839680..3104256970751: 131072: 3104256966656: encoded,shared
88: 23003136..23134207: 3104256843776..3104256974847: 131072: 3104256970752: encoded,shared
89: 23134208..23265279: 3104256851968..3104256983039: 131072: 3104256974848: encoded,shared
90: 23265280..23396351: 3104256860160..3104256991231: 131072: 3104256983040: encoded,shared
91: 23396352..23437311: 3104256868352..3104256909311: 40960: 3104256991232: encoded,shared
92: 23789568..23801855: 3104256872448..3104256884735: 12288: 3104257261568: encoded,shared
93: 23805952..23842815: 3104256880640..3104256917503: 36864: 3104256888832: encoded,shared
94: 23846912..23953407: 3104256901120..3104257007615: 106496: 3104256921600: encoded,shared
95: 23957504..23982079: 3104256954368..3104256978943: 24576: 3104257011712: encoded,shared
96: 24043520..24113151: 3104256966656..3104257036287: 69632: 3104257040384: encoded,shared
97: 24121344..24182783: 3104256995328..3104257056767: 61440: 3104257044480: shared
98: 24199168..24215551: 3104257056768..3104257073151: 16384: encoded,shared
99: 24305664..24330239: 3104257069056..3104257093631: 24576: 3104257163264: encoded,shared
100: 24346624..24444927: 3104257085440..3104257183743: 98304: 3104257110016: encoded,shared
101: 24969216..25022463: 3104257130496..3104257183743: 53248: 3104257708032: last,encoded,shared,eof
pathA: 89 extents found
pathB
Filesystem type is: 9123683e
File size of pathB is 25021930 (25022464 blocks of 1 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 8122367: 3119203209216..3119211331583: 8122368: shared
1: 8126464.. 8163327: 3104252211200..3104252248063: 36864: 3119211335680: encoded,shared
2: 8183808.. 8212479: 3104252227584..3104252256255: 28672: 3104252268544: encoded,shared
3: 8548352.. 8679423: 3104252243968..3104252375039: 131072: 3104252592128: encoded,shared
4: 8679424.. 9596927: 3119211331584..3119212249087: 917504: 3104252375040: shared
5: 9596928.. 9727999: 3104252329984..3104252461055: 131072: 3119212249088: encoded,shared
6: 9728000..10645503: 3119212249088..3119213166591: 917504: 3104252461056: shared
7: 10645504..10776575: 3104252432384..3104252563455: 131072: 3119213166592: encoded,shared
8: 10776576..10907647: 3104252538880..3104252669951: 131072: 3104252563456: encoded,shared
9: 10907648..11038719: 3104252641280..3104252772351: 131072: 3104252669952: encoded,shared
10: 11038720..11169791: 3104252743680..3104252874751: 131072: 3104252772352: encoded,shared
11: 11169792..11300863: 3104252846080..3104252977151: 131072: 3104252874752: encoded,shared
12: 11300864..11431935: 3104252952576..3104253083647: 131072: 3104252977152: encoded,shared
13: 11431936..11563007: 3104253054976..3104253186047: 131072: 3104253083648: encoded,shared
14: 11563008..11694079: 3104253161472..3104253292543: 131072: 3104253186048: encoded,shared
15: 11694080..11825151: 3104253267968..3104253399039: 131072: 3104253292544: encoded,shared
16: 11825152..12742655: 3119213166592..3119214084095: 917504: 3104253399040: shared
17: 12742656..12873727: 3104253374464..3104253505535: 131072: 3119214084096: encoded,shared
18: 12873728..13266943: 3119214084096..3119214477311: 393216: 3104253505536: shared
19: 13266944..13398015: 3104253476864..3104253607935: 131072: 3119214477312: encoded,shared
20: 13398016..13529087: 3104253583360..3104253714431: 131072: 3104253607936: encoded,shared
21: 13529088..13660159: 3104253689856..3104253820927: 131072: 3104253714432: encoded,shared
22: 13660160..13791231: 3104253796352..3104253927423: 131072: 3104253820928: encoded,shared
23: 13791232..13922303: 3104253902848..3104254033919: 131072: 3104253927424: encoded,shared
24: 13922304..14053375: 3104254013440..3104254144511: 131072: 3104254033920: encoded,shared
25: 14053376..14315519: 3119214477312..3119214739455: 262144: 3104254144512: shared
26: 14315520..14446591: 3104254119936..3104254251007: 131072: 3119214739456: encoded,shared
27: 14446592..14577663: 3104254226432..3104254357503: 131072: 3104254251008: encoded,shared
28: 14577664..14708735: 3104254332928..3104254463999: 131072: 3104254357504: encoded,shared
29: 14708736..14839807: 3104254418944..3104254550015: 131072: 3104254464000: shared
30: 14839808..14950399: 3104254550016..3104254660607: 110592: encoded,shared
31: 14958592..14962687: 3104254631936..3104254636031: 4096: 3104254668800: shared
32: 14966784..14999551: 3104254636032..3104254668799: 32768: encoded,shared
33: 15007744..15011839: 3104254648320..3104254652415: 4096: 3104254676992: shared
34: 15020032..15024127: 3104254652416..3104254656511: 4096: shared
35: 15036416..15060991: 3104254656512..3104254681087: 24576: encoded,shared
36: 15065088..15077375: 3104254660608..3104254672895: 12288: 3104254685184: encoded,shared
37: 15085568..15089663: 3104254668800..3104254672895: 4096: 3104254681088: shared
38: 15110144..15122431: 3104254672896..3104254685183: 12288: encoded,shared
39: 15151104..15155199: 3104254676992..3104254681087: 4096: 3104254713856: shared
40: 15171584..15228927: 3104254681088..3104254738431: 57344: encoded,shared
41: 15233024..15347711: 3104254705664..3104254820351: 114688: 3104254742528: encoded,shared
42: 15351808..15482879: 3104254750720..3104254881791: 131072: 3104254824448: encoded,shared
43: 15482880..15613951: 3104254808064..3104254939135: 131072: 3104254881792: encoded,shared
44: 15613952..15745023: 3104254865408..3104254996479: 131072: 3104254939136: encoded,shared
45: 15745024..15876095: 3104254922752..3104255053823: 131072: 3104254996480: encoded,shared
46: 15876096..16007167: 3104254980096..3104255111167: 131072: 3104255053824: encoded,shared
47: 16007168..16138239: 3104255037440..3104255168511: 131072: 3104255111168: encoded,shared
48: 16138240..16269311: 3104255102976..3104255234047: 131072: 3104255168512: encoded,shared
49: 16269312..16400383: 3104255188992..3104255320063: 131072: 3104255234048: encoded,shared
50: 16400384..16531455: 3104255270912..3104255401983: 131072: 3104255320064: encoded,shared
51: 16531456..16662527: 3104255361024..3104255492095: 131072: 3104255401984: encoded,shared
52: 16662528..16777215: 3104255451136..3104255565823: 114688: 3104255492096: encoded,shared
53: 16777216..16793599: 3104255451136..3104255467519: 16384: 3104255565824: encoded,shared
54: 16793600..16924671: 3104255537152..3104255668223: 131072: 3104255467520: encoded,shared
55: 16924672..17055743: 3104255614976..3104255746047: 131072: 3104255668224: encoded,shared
56: 17055744..17092607: 3104255709184..3104255746047: 36864: 3104255746048: shared
57: 17121280..17145855: 3104255746048..3104255770623: 24576: shared
58: 17154048..17285119: 3104255770624..3104255901695: 131072: encoded,shared
59: 17285120..17334271: 3104255868928..3104255918079: 49152: 3104255901696: encoded,shared
60: 17338368..17362943: 3104255897600..3104255922175: 24576: 3104255922176: encoded,shared
61: 17367040..17465343: 3104255909888..3104256008191: 98304: 3104255926272: encoded,shared
62: 17469440..17600511: 3104255967232..3104256098303: 131072: 3104256012288: encoded,shared
63: 17600512..17723391: 3104256053248..3104256176127: 122880: 3104256098304: encoded,shared
64: 17727488..17858559: 3104256139264..3104256270335: 131072: 3104256180224: encoded,shared
65: 17858560..17879039: 3104256225280..3104256245759: 20480: 3104256270336: shared
66: 17948672..17977343: 3104256245760..3104256274431: 28672: shared
67: 17989632..18010111: 3104256274432..3104256294911: 20480: shared
68: 18022400..18153471: 3104256294912..3104256425983: 131072: encoded,shared
69: 18153472..18284543: 3104256380928..3104256511999: 131072: 3104256425984: encoded,shared
70: 18284544..18415615: 3104256462848..3104256593919: 131072: 3104256512000: encoded,shared
71: 18415616..18419711: 3104256548864..3104256552959: 4096: 3104256593920: shared
72: 18423808..18468863: 3104256552960..3104256598015: 45056: encoded,shared
73: 18472960..19275775: 3119214739456..3119215542271: 802816: 3104256602112: shared
74: 19288064..19308543: 3104256577536..3104256598015: 20480: 3119215554560: encoded,shared
75: 19365888..19496959: 3104256581632..3104256712703: 131072: 3104256655360: encoded,shared
76: 19496960..19542015: 3104256618496..3104256663551: 45056: 3104256712704: encoded,shared
77: 19595264..19726335: 3104256634880..3104256765951: 131072: 3104256716800: encoded,shared
78: 19726336..19836927: 3104256712704..3104256823295: 110592: 3104256765952: encoded,shared
79: 19931136..19939327: 3104256786432..3104256794623: 8192: 3104256917504: encoded,shared
80: 19943424..19988479: 3104256790528..3104256835583: 45056: 3104256798720: encoded,shared
81: 19992576..20123647: 3104256794624..3104256925695: 131072: 3104256839680: encoded,shared
82: 20123648..20254719: 3104256798720..3104256929791: 131072: 3104256925696: encoded,shared
83: 20254720..20385791: 3104256806912..3104256937983: 131072: 3104256929792: encoded,shared
84: 20385792..20516863: 3104256815104..3104256946175: 131072: 3104256937984: encoded,shared
85: 20516864..20647935: 3104256823296..3104256954367: 131072: 3104256946176: encoded,shared
86: 20647936..20721663: 3104256831488..3104256905215: 73728: 3104256954368: encoded,shared
87: 22740992..22872063: 3104256835584..3104256966655: 131072: 3104258924544: encoded,shared
88: 22872064..23003135: 3104256839680..3104256970751: 131072: 3104256966656: encoded,shared
89: 23003136..23134207: 3104256843776..3104256974847: 131072: 3104256970752: encoded,shared
90: 23134208..23265279: 3104256851968..3104256983039: 131072: 3104256974848: encoded,shared
91: 23265280..23396351: 3104256860160..3104256991231: 131072: 3104256983040: encoded,shared
92: 23396352..23437311: 3104256868352..3104256909311: 40960: 3104256991232: encoded,shared
93: 23789568..23801855: 3104256872448..3104256884735: 12288: 3104257261568: encoded,shared
94: 23805952..23842815: 3104256880640..3104256917503: 36864: 3104256888832: encoded,shared
95: 23846912..23953407: 3104256901120..3104257007615: 106496: 3104256921600: encoded,shared
96: 23957504..23982079: 3104256954368..3104256978943: 24576: 3104257011712: encoded,shared
97: 24043520..24113151: 3104256966656..3104257036287: 69632: 3104257040384: encoded,shared
98: 24121344..24182783: 3104256995328..3104257056767: 61440: 3104257044480: shared
99: 24199168..24215551: 3104257056768..3104257073151: 16384: encoded,shared
100: 24305664..24330239: 3104257069056..3104257093631: 24576: 3104257163264: encoded,shared
101: 24346624..24444927: 3104257085440..3104257183743: 98304: 3104257110016: encoded,shared
102: 24969216..25022463: 3104257130496..3104257183743: 53248: 3104257708032: last,encoded,shared,eof
pathB: 90 extents found
If you compare extent 52 of file A to extents 52 and 53 of file B, it looks like the files are indeed reflinked, just in an unusual way: file A uses a single extent to represent the data, whereas file B uses two extents references with the same physical start offset.
This is tricky, because --is-reflink
doesn't actually look at the file data to determine if files are reflinked, so it doesn't know that the first 16K and last 16K of that extent have the same content. Even I am just assuming that is true, since FIDEDUPERANGE has been run on them.
I wonder how the extents ended up like that in the first place. Perhaps you have run something like bees on this filesystem? As far as I know, plain rmlint --dedupe
/FIDEDUPERANGE or cp --reflink
cannot create this situation.
If this bothers you, you could defrag the files in question—breaking all reflinks—and try to dedupe them again with rmlint. compsize
may tell you that your file data is actually well-deduplicated already - compare the "Referenced" and "Uncompressed" columns.
Thanks. Since i have seen the outputs of filefrag I started experimenting with btrfs and compression and defrag. It seems no compression, compress=lzo and compress-force=lzo yields hugely diffrent amounts of extents.
It seems i cannot make btrfs make only 1 extent of the file, Im not getting below 40 extents, with force lzo compression i get to like 200 extents...
The files were both uploaded via rsync - their name is quite diffrent, so I didnt even expect them to be identical - at least it would seem unlikely, because of their name and the folder's.
btrfs does have a maximum extent size. It is smaller for compressed extents than uncompressed extents. The main purpose of defrag is to at least reduce the number of extents, with a side-effect of breaking reflinks, and the option of changing the compression algorithm since the data is being re-written anyway. I don't think there's any reason you should force compression, the default heuristic is there for a reason.
I came across a weird case of duplicates not getting deduplicated on btrfs (no snapshots on this FS, just raid10)
I use:
rmlint --types="duplicates" --config=sh:handler=clone --no-crossdev --hidden /srv/[something]
While some files get deduplicated and
rmlint --is-reflink "pathA" "pathB"
returns 0 on those, some files seem to not be deduplicated and--is-reflink
returns 1, even after manually running after a seemingly successfulrmlint --dedupe "pathA" "pathB"
on them.In total it seems like 1/3 of all the duplicates in
/srv/[something]
seem to not be deduplicated.strace'ing stuff doesnt really help either.
It seems that the dedup calls are sent and return 0, but nothing really happens.
filefrage pathA pathB
returns 2 diffrent extent counts,rmlint --is-reflink "pathA" "pathB"
returns 1.