Ext filesystem recovery

Exclude packages

Cli

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
$ dd if=/dev/zero of=/dev/shm/test bs=1M count=512
$ mfks.ext3 -b 4096 /dev/shm/test
$ mount /dev/shm/test /mnt

$ rm -f test;for i in {0..10000}; do echo $i-$i-$i >> test; done
$ filefrag -v test
Filesystem type is: ef53
Filesystem cylinder groups approximately 4
File size of test is 146688 (36 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 15: 2576.. 2591: 16: merged
1: 16.. 16: 33424.. 33424: 1: 2592: merged
2: 17.. 17: 33457.. 33457: 1: 33425: merged
3: 18.. 18: 33490.. 33490: 1: 33458: merged
4: 19.. 19: 33523.. 33523: 1: 33491: merged
5: 20.. 20: 33556.. 33556: 1: 33524: merged
6: 21.. 21: 33589.. 33589: 1: 33557: merged
7: 22.. 22: 33622.. 33622: 1: 33590: merged
8: 23.. 23: 33655.. 33655: 1: 33623: merged
9: 24.. 24: 33688.. 33688: 1: 33656: merged
10: 25.. 25: 33721.. 33721: 1: 33689: merged
11: 26.. 26: 33754.. 33754: 1: 33722: merged
12: 27.. 27: 33787.. 33787: 1: 33755: merged
13: 28.. 28: 33820.. 33820: 1: 33788: merged
14: 29.. 29: 33853.. 33853: 1: 33821: merged
15: 30.. 30: 33886.. 33886: 1: 33854: merged
16: 31.. 31: 33919.. 33919: 1: 33887: merged
17: 32.. 32: 33952.. 33952: 1: 33920: merged
18: 33.. 33: 34017.. 34017: 1: 33953: merged
19: 34.. 34: 34082.. 34082: 1: 34018: merged
20: 35.. 35: 34147.. 34147: 1: 34083: last,merged,eof


debugfs /dev/shm/test
debugfs 1.42.13 (17-May-2015)
debugfs: stat <14>

Inode: 14 Type: regular Mode: 0644 Flags: 0x0
Generation: 3749441442 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 146688
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 296
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x58763a68:1f1d1ee4 -- Wed Jan 11 22:00:08 2017
atime: 0x58763a67:e66e9d44 -- Wed Jan 11 22:00:07 2017
mtime: 0x58763a68:1f1d1ee4 -- Wed Jan 11 22:00:08 2017
crtime: 0x58763a67:e66e9d44 -- Wed Jan 11 22:00:07 2017
Size of extra inode fields: 32
BLOCKS:
(0-11):2576-2587, (IND):1538, (12-15):2588-2591, (16):33424, (17):33457, (18):33490, (19):33523, (20):33556, (21):33589, (22):33622, (23):33655, (24):33688, (25):33721, (26):33754, (27):33787, (28):33820, (29):33853, (30):33886, (31):33919, (32):33952, (33):34017, (34):34082, (35):34147
TOTAL: 37

dd if=/dev/shm/test of=test-1 bs=4K skip=2576 count=$((2591-2576+1))
head test-1 ; wc -l test-1 ;tail test-1
0-0-0
1-1-1
2-2-2
3-3-3
4-4-4
5-5-5
6-6-6
7-7-7
8-8-8
9-9-9
4591 test-1
4582-4582-4582
4583-4583-4583
4584-4584-4584
4585-4585-4585
4586-4586-4586
4587-4587-4587
4588-4588-4588
4589-4589-4589
4590-4590-4590
4

dd if=/dev/shm/test of=test-2 bs=4K skip=33424 count=1
1+0 records in
1+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.000193943 s, 21.1 MB/s
root@homerl-System-Product-Name:/mnt# head test-2 ; wc -l test-2 ;tail test-2
591-4591-4591
4592-4592-4592
4593-4593-4593
4594-4594-4594
4595-4595-4595
4596-4596-4596
4597-4597-4597
4598-4598-4598
4599-4599-4599
4600-4600-4600
273 test-2
4855-4855-4855
4856-4856-4856
4857-4857-4857
4858-4858-4858
4859-4859-4859
4860-4860-4860
4861-4861-4861
4862-4862-4862
4863-4863-4863
48


root@homerl-System-Product-Name:/mnt# dd if=/dev/shm/test of=test-3 bs=4K skip=33457 count=1
1+0 records in
1+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.000193132 s, 21.2 MB/s
root@homerl-System-Product-Name:/mnt# head test-3 ; wc -l test-3 ;tail test-3
64-4864-4864
4865-4865-4865
4866-4866-4866
4867-4867-4867
4868-4868-4868
4869-4869-4869
4870-4870-4870
4871-4871-4871
4872-4872-4872
4873-4873-4873
273 test-3
5128-5128-5128
5129-5129-5129
5130-5130-5130
5131-5131-5131
5132-5132-5132
5133-5133-5133
5134-5134-5134
5135-5135-5135
5136-5136-5136
513