There's a corrupt file on my (rooted) Android device at /data/anr/traces.txt

when I cd to this directory with adb shell, or try to do cat or rm on this file I get I/O error

Most importantly it prevents me from having a TWRP backup, as it fails at reading this file,

How can I either delete it or fix it?

Deleting anr folder with ES File Explorer or Cyanogen Built In File Manager results in error, also these file explorers don't actually show any files inside anr folder

update on comment:

running fsck.f2fs outputs ```

~ # fsck.f2fs -f /dev/block/mmcblk0p48
Info: Force to fix corruption
Info: sector size = 512
Info: total sectors = 50454272 (24635 MB)
Info: MKFS version
  "Linux version 3.10.84-perf-g329ac5f (hudsoncm@ilclbld30) (gcc version 4.9.x-google 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Wed Apr 20 17:03:52 CDT 2016"
Info: FSCK version
  from "Linux version 3.10.84-perf-g0ec7138 (hudsoncm@ilclbld87) (gcc version 4.9.x-google 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Nov 3 05:01:11 CST 2015"
    to "Linux version 3.10.84-perf-g0ec7138 (hudsoncm@ilclbld87) (gcc version 4.9.x-google 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Nov 3 05:01:11 CST 2015"
Info: superblock features = 1 :  encrypt
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 50454272 (24635 MB)
Info: CKPT version = 10de4e
Info: checkpoint state = 5 :  compacted_summary unmount

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x0]
[FSCK] valid_block_count matching with CP             [Ok..] [0x2beeaa]
[FSCK] valid_node_count matcing with CP (de lookup)   [Ok..] [0x723f]
[FSCK] valid_node_count matcing with CP (nat lookup)  [Ok..] [0x723f]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x69ed]
[FSCK] free segment_count matched with CP             [Ok..] [0x12ca]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]

but next ls -l /data/anr/ reveals that file is still corrupted

i know exact inode of the offender

|-- anr <ino = 0x476b>, <encrypted (0)>
|   |-- traces.txt <ino = 0x3c19>, <encrypted (0)>

Any ideas? I dont want to format /data i have stuff on it I want to backup with TWRP

  • Did you try fsck ? – Gokul NC Nov 4 '16 at 15:45
  • @GokulNC please see update – ArtDeineka Nov 4 '16 at 16:03
  • You wrote cat gives you an error as well – but didn't specify which way you've used cat. I assume you've already tried something like echo foo > traces.txt? Not that I give it much hope, but worth a try I'd say. Apart from that, this answer on our sister-site might be helpful – if debugfs is available on your device. – Izzy Nov 4 '16 at 18:12
  • @Izzy no, echo gives same error, debugfs is not available on my system :( – ArtDeineka Nov 5 '16 at 11:20
  • OK, sorry for that – but was worth a try. I'm out of ideas then. The only thing I rawly can think of is finding out what block the iNode belongs to, and mark that as "bad". But I've got no idea how to do that. – Izzy Nov 5 '16 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.