Recover files after hard lock up

Hi,

System hard locked so had to pull the power cord. One of the ext4 drives wasn’t being recognised so tried fsck to recover it. It threw a message part way though checking - something about an inode - and when I restarted quick a few video files are now missing, but not all. It left fanart and nfo files strangely enough.

I know I can recover individually with testdisk but that’s quite a pain for hundreds of files. Is there another way?

Ta

If you have some form of backup mechanism in place that would be my first point of call, just restore from backup rather than trying to recover a dead/corrupt file from the existing disk.

:smiley: If only. Nope.

Okay. Further to this, seems the file system on device is corrupt . Running fsck it errors saying: fsck: Warning… fsck.ext4 for device /dev/sda1 exited with signal 9.

Which appears to be oom killing it - see below . I tried to exlcude fsck from oom using sudo echo -17 > /proc/3510/oom_score_adj but this seems not to have worked. Any idea how I can get the check to complete?

[ 4980.094623] WARNING: CPU: 0 PID: 1 at mm/vmscan.c:1551 shrink_inactive_list+0x550/0x560() [ 4980.094628] isolated:113, cma:0, inactive:102, mask:213da, file:1 [ 4980.094632] Modules linked in: hidp xt_nat xt_tcpudp xt_conntrack bnep hci_uart ipt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype bridge stp llc aufs btsdio bluetooth 6lowpan_iphc 8021q iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_filter dwc_otg dhd cfg80211 wifi_dummy ir_lirc_codec(O) lirc_dev(O) mali meson_ir(O) rc_core(O) amlvideodri(O) videobuf_res(O) videobuf_core(O) videodev(O) media(O) ip_tables x_tables [ 4980.094713] CPU: 0 PID: 1 Comm: systemd Tainted: G O 3.14.29-157-osmc #1 [ 4980.094717] Call trace: [ 4980.094726] [<ffffffc001087ae8>] dump_backtrace+0x0/0x128 [ 4980.094731] [<ffffffc001087c30>] show_stack+0x20/0x30 [ 4980.094739] [<ffffffc0018cea08>] dump_stack+0x78/0x94 [ 4980.094747] [<ffffffc0010943e8>] warn_slowpath_common+0x90/0xc0 [ 4980.094752] [<ffffffc001094478>] warn_slowpath_fmt+0x60/0x78 [ 4980.094758] [<ffffffc00115a974>] shrink_inactive_list+0x54c/0x560 [ 4980.094764] [<ffffffc00115afe8>] shrink_lruvec+0x308/0x5b8 [ 4980.094769] [<ffffffc00115b304>] shrink_zone+0x6c/0x1a8 [ 4980.094774] [<ffffffc00115b510>] do_try_to_free_pages+0xd0/0x550 [ 4980.094779] [<ffffffc00115ba70>] try_to_free_pages+0xe0/0x178 [ 4980.094787] [<ffffffc00114edc4>] __alloc_pages_nodemask+0x6cc/0xa28 [ 4980.094793] [<ffffffc0011528e8>] __do_page_cache_readahead+0xc8/0x380 [ 4980.094800] [<ffffffc0011466e8>] filemap_fault+0x210/0x4e8 [ 4980.094807] [<ffffffc00116e750>] __do_fault+0x78/0x610 [ 4980.094813] [<ffffffc001172be0>] handle_mm_fault+0x180/0xcc0 [ 4980.094820] [<ffffffc00108fd80>] do_page_fault+0x1d8/0x260 [ 4980.094825] [<ffffffc00108123c>] do_mem_abort+0x4c/0xa8 [ 4980.094829] Exception stack(0xffffffc05ebffe30 to 0xffffffc05ebfff50) [ 4980.094835] fe20: 00000000 00000000 00000000 00000000 [ 4980.094844] fe40: ffffffff ffffffff f744e630 00000000 00000007 00000000 00000043 ffffffc0 [ 4980.094854] fe60: 5ebffe90 ffffffc0 0110feb0 ffffffc0 5ebffe90 ffffffc0 0110fec4 ffffffc0 [ 4980.094861] fe80: 5ebfc000 ffffffc0 00000000 00000080 00000000 00000000 0108422c ffffffc0 [ 4980.094867] fea0: 00000000 00000000 00000000 00000000 ffffffff ffffffff 010842d4 ffffffc0 [ 4980.094873] fec0: 00001374 00000000 0a9d90c7 00000000 0a9d90c7 00000000 00000000 00000000 [ 4980.094879] fee0: 000003e8 00000000 00000000 00000000 f759dce8 00000000 ff9aa9fc 00000000 [ 4980.094885] ff00: 00001374 00000000 ff9aae60 00000000 ffffffff 00000000 00000001 00000000 [ 4980.094891] ff20: 00000043 00000000 00000004 00000000 f7572838 00000000 ff9aa9e8 00000000 [ 4980.094895] ff40: f74f003d 00000000 00000000 00000000 [ 4980.094900] ---[ end trace bf4ddad6369f60e4 ]--- [ 4980.902215] supervisord invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 [ 4980.902229] supervisord cpuset=/ mems_allowed=0 [ 4980.902236] CPU: 2 PID: 409 Comm: supervisord Tainted: G W O 3.14.29-157-osmc #1 [ 4980.902240] Call trace: [ 4980.902253] [<ffffffc001087ae8>] dump_backtrace+0x0/0x128 [ 4980.902259] [<ffffffc001087c30>] show_stack+0x20/0x30 [ 4980.902267] [<ffffffc0018cea08>] dump_stack+0x78/0x94 [ 4980.902275] [<ffffffc001148008>] dump_header.isra.6+0x88/0x1e0 [ 4980.902281] [<ffffffc001148774>] oom_kill_process+0x2dc/0x418 [ 4980.902286] [<ffffffc001148d84>] out_of_memory+0x2cc/0x300 [ 4980.902294] [<ffffffc00114f108>] __alloc_pages_nodemask+0xa10/0xa28 [ 4980.902299] [<ffffffc001146768>] filemap_fault+0x290/0x4e8 [ 4980.902307] [<ffffffc00116e750>] __do_fault+0x78/0x610 [ 4980.902313] [<ffffffc001172be0>] handle_mm_fault+0x180/0xcc0 [ 4980.902320] [<ffffffc00108fd80>] do_page_fault+0x1d8/0x260 [ 4980.902326] [<ffffffc00108123c>] do_mem_abort+0x4c/0xa8 [ 4980.902330] Exception stack(0xffffffc05ed93e30 to 0xffffffc05ed93f50) [ 4980.902336] 3e20: 00000000 00000000 00000000 00000000 [ 4980.902343] 3e40: ffffffff ffffffff f7577716 00000000 5ed93e90 ffffffc0 011b8e64 ffffffc0 [ 4980.902349] 3e60: 00000002 00000000 ab821250 00000000 000003e8 00000000 00000020 00000000 [ 4980.902355] 3e80: 82000007 00000000 f75397a4 00000000 5ed93eb0 ffffffc0 010875ec ffffffc0 [ 4980.902361] 3ea0: 00400008 00000000 5ed93ed0 ffffffc0 00000000 00000000 010842d4 ffffffc0 [ 4980.902367] 3ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000002 00000000 [ 4980.902373] 3ee0: 000003e8 00000000 ab2cdf9c 00000000 f6cc2560 00000000 00000000 00000000 [ 4980.902379] 3f00: 00000000 00000000 000000a8 00000000 000003e8 00000000 ab821050 00000000 [ 4980.902385] 3f20: ab821258 00000000 ffe0ba98 00000000 00000000 00000000 ffe0ba74 00000000 [ 4980.902390] 3f40: ab1537e7 00000000 00000000 00000000 [ 4980.902393] Mem-Info: [ 4980.902397] Normal per-cpu: [ 4980.902401] CPU 0: hi: 186, btch: 31 usd: 30 [ 4980.902406] CPU 1: hi: 186, btch: 31 usd: 30 [ 4980.902410] CPU 2: hi: 186, btch: 31 usd: 31 [ 4980.902413] CPU 3: hi: 186, btch: 31 usd: 0 [ 4980.902426] active_anon:297311 inactive_anon:118238 isolated_anon:0 active_file:743 inactive_file:1878 isolated_file:17 unevictable:0 dirty:0 writeback:2 unstable:0 free:8180 slab_reclaimable:6048 slab_unreclaimable:4160 mapped:457 shmem:466 pagetables:1539 bounce:0 used_cma:874 cma:0 anon_cma:60546 file_cma:10 isolate_cma:0 isolate:0 unmovable:8150 reclaimable:0 movable:0 reserve:0 [ 4980.902450] Normal free:32720kB min:32768kB low:40960kB high:49152kB active_anon:1189244kB inactive_anon:472952kB active_file:2972kB inactive_file:7512kB unevictable:0kB isolated(anon):0kB isolated(file):68kB present:2011136kB managed:1798468kB mlocked:0kB dirty:0kB writeback:8kB mapped:1828kB shmem:1864kB slab_reclaimable:24192kB slab_unreclaimable:16640kB kernel_stack:4512kB pagetables:6156kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:16301 all_unreclaimable? yes [ 4980.902455] lowmem_reserve[]: 0 0 [ 4980.902461] Normal: 8150*4kB (U) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 32600kB [ 4980.902479] 3204 total pagecache pages [ 4980.902484] 38 pages in swap cache [ 4980.902488] Swap cache stats: add 44658, delete 44620, find 4695/7227 [ 4980.902491] Free swap = 0kB [ 4980.902494] Total swap = 131068kB [ 4980.902497] 502784 pages RAM [ 4980.902500] 0 pages HighMem/MovableOnly [ 4980.902503] 53167 pages reserved [ 4980.902506] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name [ 4980.902533] [ 172] 0 172 3444 358 8 67 0 systemd-journal [ 4980.902542] [ 201] 0 201 3161 144 7 0 -1000 systemd-udevd [ 4980.902551] [ 243] 0 243 1448 79 7 0 0 rpcbind [ 4980.902559] [ 288] 0 288 1515 103 8 0 0 systemd-logind [ 4980.902566] [ 295] 0 295 1186 190 6 6 0 smartd [ 4980.902573] [ 296] 0 296 444 28 6 0 0 lircd [ 4980.902580] [ 297] 106 297 1366 158 7 1 -900 dbus-daemon [ 4980.902588] [ 338] 0 338 2243 142 8 4 0 connmand [ 4980.902594] [ 340] 108 340 1330 102 7 0 0 avahi-daemon [ 4980.902601] [ 347] 0 347 473 29 5 0 0 eventlircd [ 4980.902607] [ 381] 108 381 1299 73 7 0 0 avahi-daemon [ 4980.902614] [ 409] 0 409 4334 316 12 1721 0 supervisord [ 4980.902621] [ 411] 1000 411 52870 21651 107 4532 0 mono [ 4980.902627] [ 423] 0 423 1110 1 6 66 0 mediacenter [ 4980.902634] [ 427] 0 427 237569 3070 45 839 0 containerd [ 4980.902641] [ 430] 0 430 242593 5823 56 1476 -500 dockerd [ 4980.902648] [ 436] 0 436 866 28 5 0 0 agetty [ 4980.902655] [ 477] 0 477 1942 94 8 0 0 wpa_supplicant [ 4980.902664] [ 497] 0 497 2124 124 8 9 -1000 sshd [ 4980.902671] [ 600] 0 600 1836 1 7 86 0 sudo [ 4980.902678] [ 612] 1000 612 188567 17512 203 16620 0 kodi.bin [ 4980.902684] [ 720] 105 720 1766 113 7 0 0 ntpd [ 4980.902692] [ 733] 0 733 362 20 4 0 0 hciattach [ 4980.902699] [ 742] 0 742 1426 105 7 0 0 bluetoothd [ 4980.902706] [ 810] 1001 810 11985 2505 18 210 0 python2.7 [ 4980.902757] [ 906] 0 906 209757 290 14 0 -500 docker-proxy [ 4980.902765] [ 918] 0 918 199793 199 9 0 -999 containerd-shim [ 4980.902772] [ 936] 1000 936 158 5 4 2 0 tini [ 4980.902778] [ 943] 0 943 9039 246 11 1 0 polkitd [ 4980.902785] [ 958] 0 958 6771 260 11 0 0 udisks-daemon [ 4980.902793] [ 959] 0 959 2023 89 8 0 0 udisks-daemon [ 4980.902800] [ 981] 1000 981 28512 860 84 996 0 node [ 4980.902808] [ 1000] 1000 1000 1958 135 7 0 0 udisks-glue [ 4980.902818] [ 1924] 0 1924 2413 167 8 8 0 sshd [ 4980.902825] [ 1932] 1000 1932 2034 56 7 134 0 systemd [ 4980.902832] [ 1937] 1000 1937 6723 163 11 139 0 (sd-pam) [ 4980.902839] [ 1945] 1000 1945 2413 172 8 9 0 sshd [ 4980.902846] [ 1950] 1000 1950 1193 67 5 88 0 bash [ 4980.902854] [ 2023] 0 2023 2413 169 9 6 0 sshd [ 4980.902861] [ 2041] 1000 2041 2413 181 9 8 0 sshd [ 4980.902868] [ 2046] 1000 2046 1188 0 6 149 0 bash [ 4980.902876] [ 2096] 1000 2096 867 15 6 16 0 dmesg [ 4980.902883] [ 3465] 0 3465 2413 162 8 17 0 sshd [ 4980.902890] [ 3479] 1000 3479 2413 166 8 13 0 sshd [ 4980.902897] [ 3484] 1000 3484 1188 0 6 149 0 bash [ 4980.902904] [ 3509] 1000 3509 1116 2 6 47 0 fsck [ 4980.902911] [ 3510] 1000 3510 363893 359242 714 3593 -17 fsck.ext4 [ 4980.902920] Out of memory: Kill process 3510 (fsck.ext4) score 736 or sacrifice child [ 4980.902926] Killed process 3510 (fsck.ext4) total-vm:1455572kB, anon-rss:1436968kB, file-rss:0kB