{"id":1908,"date":"2023-06-03T15:19:40","date_gmt":"2023-06-03T13:19:40","guid":{"rendered":"https:\/\/hannes.enjoys.it\/blog\/?p=1908"},"modified":"2023-06-11T19:51:11","modified_gmt":"2023-06-11T17:51:11","slug":"i-cant-read-file-contents-from-my-android-sd-card-on-linux-and-its-weird","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2023\/06\/i-cant-read-file-contents-from-my-android-sd-card-on-linux-and-its-weird\/","title":{"rendered":"I can&#8217;t read file contents from my Android SD card on Linux and it&#8217;s weird"},"content":{"rendered":"\n<p>Conclusion: <strong>The files are encrypted with <a href=\"https:\/\/source.android.com\/docs\/security\/features\/encryption\/file-based\">Android&#8217;s file-based encryption<\/a>. The SD card is broken.<\/strong><\/p>\n\n\n\n<p><em>The SD card is broken. The internet says it is typical for SD cards to go read-only as a symptom of fail. Trying to <code>rsync<\/code> or <code>ddrescue<\/code> the card&#8217;s contents using a separate devices led to stalls and read errors.<\/em><\/p>\n\n\n\n<p><em>I might be able to salvage some of the files by using Android&#8217;s share functionality but there was nothing important on the card so I won&#8217;t bother trying. The card is broken beyond repair and all files are lost.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>I want to backup my Android SD card so I inserted it to my computer (tried multiple ones by now). I can see the file tree and browse it just fine. But if I try to read a file, it fails because instead of the actual file contents, all I get is some gibberish. Weirdly enough, the file header is partially identical between different files and contains the words &#8220;whatever&#8221; and &#8220;CONSOLE&#8221;. When inserted in my phone I can read and use those files just fine. The phone is a Sony Xperia XZ1 Compact.<\/p>\n\n\n\n<p>Here are some example hexdumps of the file headers from some JPG and OPUS files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">00000000  00 00 00 00 00 37 d5 23  d8 c3 44 86 e4 42 f3 73  |.....7.#..D..B.s|\n00000010  03 00 00 02 00 00 10 00  00 02 8c 2d 04 09 03 01  |...........-....|\n00000020  77 68 61 74 65 76 65 72  60 ed 60 a5 16 dd d0 08  |whatever`.`.....|\n00000030  34 0d 25 2b 87 d1 df 18  94 8a f8 cf f0 fd 83 d9  |4.%+............|\n00000040  06 5a 4e 48 8c a1 b9 51  98 ed 16 62 08 5f 43 4f  |.ZNH...Q...b._CO|\n00000050  4e 53 4f 4c 45 00 00 00  00 60 40 2d b1 41 51 c1  |NSOLE....`@-.AQ.|\n00000060  10 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n*\n00002000  c7 27 3f d6 7e 99 3d 6b  d3 dc 0a a7 c9 28 37 d5  |.'?.~.=k.....(7.|\n00002010  59 09 8b 4b 3e 1b 20 54  a8 87 fc 90 fd 31 05 5b  |Y..K&gt;. T.....1.[|\n...\n0037ffe0  f1 9a 2d fa fd a1 4b 2a  22 dc ce 29 9d 83 3a 5a  |..-...K*\"..)..:Z|\n0037fff0  dc 97 e0 e9 15 d7 16 55  82 a6 57 6b 7f b0 32 7d  |.......U..Wk..2}|\n00380000\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">00000000  00 00 00 00 00 03 5d 1d  aa ab 3d 85 96 2a 8a 70  |......]...=..*.p|\n00000010  03 00 00 02 00 00 10 00  00 02 8c 2d 04 09 03 01  |...........-....|\n00000020  77 68 61 74 65 76 65 72  60 90 17 d4 8b ef 31 35  |whatever`.....15|\n00000030  22 b9 b3 05 59 37 3b 71  7e e1 4a 6e af a2 07 b2  |\"...Y7;q~.Jn....|\n00000040  4b 9a bb 7e 6a 46 18 70  29 ed 16 62 08 5f 43 4f  |K..~jF.p)..b._CO|\n00000050  4e 53 4f 4c 45 00 00 00  00 60 40 2d b1 41 51 c1  |NSOLE....`@-.AQ.|\n00000060  10 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n*\n00002000  32 23 5d 69 cb 14 d0 75  8a 9c 2e 64 67 26 1a fc  |2#]i...u...dg&amp;..|\n00002010  12 77 ad 48 9b f4 9e d4  d5 08 48 33 cb 45 6b 90  |.w.H......H3.Ek.|\n...\n00037fe0  87 09 0c 80 6c 4b 6a 54  fb c2 70 13 bc 0a c9 ab  |....lKjT..p.....|\n00037ff0  89 3b 52 40 f2 cc df f4  d3 65 e1 c4 0d e3 74 ea  |.;R@.....e....t.|\n00038000\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">00000000  00 00 00 00 00 01 78 41  33 26 6e 9c 0f a7 d9 69  |......xA3&amp;n....i|\n00000010  03 00 00 02 00 00 10 00  00 02 8c 2d 04 09 03 01  |...........-....|\n00000020  77 68 61 74 65 76 65 72  60 2e 2d e8 1b cd 47 11  |whatever`.-...G.|\n00000030  7e b6 e7 e2 95 84 85 75  81 42 0f 5c 54 48 3e 4b  |~......u.B.\\TH&gt;K|\n00000040  c7 3c f6 cf 16 ec 9f 6b  51 ed 16 62 08 5f 43 4f  |.&lt;.....kQ..b._CO|\n00000050  4e 53 4f 4c 45 00 00 00  00 60 40 2d b1 41 51 c1  |NSOLE....`@-.AQ.|\n00000060  10 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\n*\n00002000  97 9d 44 91 25 8e b4 e0  07 31 31 bc cc c0 44 13  |..D.%....11...D.|\n00002010  62 0e 6d c1 49 8d 87 fe  5d c7 ff c0 cc b5 4c 08  |b.m.I...].....L.|\n...\n00019fe0  ae 2b d1 04 db d2 9c 9e  e7 cd 3a 06 aa 5a 85 5f  |.+........:..Z._|\n00019ff0  d3 7a 30 33 f2 3a b1 2f  73 40 50 f7 a9 a6 d7 fa  |.z03.:.\/s@P.....|\n0001a000\n<\/code><\/pre>\n\n\n\n<p><code>fdisk<\/code> shows the partition as &#8220;<code>W95 FAT32 (LBA)<\/code>&#8220;.<\/p>\n\n\n\n<p>What&#8217;s going on?<\/p>\n\n\n\n<p>I found some mentions of this issue on the web:<\/p>\n\n\n\n<p><a href=\"https:\/\/old.reddit.com\/r\/techsupport\/comments\/f88bd7\/files_on_sd_card_taken_out_of_phone_wont_open\/\">https:\/\/old.reddit.com\/r\/techsupport\/comments\/f88bd7\/files_on_sd_card_taken_out_of_phone_wont_open\/<\/a> posted &#8220;<code>iu&gt;i'\u00d5\u00e8\u0090 \u0152- whatever`P\u2018\u00c3@C\u008f\u201c\u017d\u00e2=\u00eb&nbsp;q\u00b8\u00cc\u00d49r\u00ca \u00af\u00d8\u00b6\u008f\u00de\u00a8K\u00edb_CONSOLE ]\u017d\u00d2[\u00d3_<\/code>&#8221; without a solution.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.computerbase.de\/forum\/threads\/videodatei-samsung-a-3-2016-am-pc-abspielen.1737550\/\">https:\/\/www.computerbase.de\/forum\/threads\/videodatei-samsung-a-3-2016-am-pc-abspielen.1737550\/<\/a> posted &#8220;<code>@\u00c2\u00f9\u00a9\u009d\u00f5\u0161\u2022\u001cBo\u0003 \u0002 \u0010 \u0002\u0152-\u0004 \u0003\u0001 `\u00bb\u00dc\u017e\u00b8\u00bd\\h\u001bt1Oc.\u00e4\u0014\u00149\u00e1\u00b25\u00d1\b\u00e9\u2019\u017d&lt;\u017e\u01789\u009d\u00db\u00df\u00ed\u0016b\b_CONSOLE \u00d8\u0017\u00fe\u00abfQ\u00bf\u00c9<\/code>&#8220;, also without a solution. The phone involved was a Samsung A3 2016. <\/p>\n\n\n\n<p><a href=\"https:\/\/www.nikon-fotografie.de\/community\/threads\/jpg-dateien-pl%C3%B6tztlich-nicht-mehr-lesbar.281280\/\">https:\/\/www.nikon-fotografie.de\/community\/threads\/jpg-dateien-pl%C3%B6tztlich-nicht-mehr-lesbar.281280\/<\/a> posted &#8220;<code>#\u00b5\u001e=\u00c4\u00f5\u00b6\u0001EBC\u0003 \u0002 \u0010 \u0002\u0152-\u0004 \u0003\u0001 \u0011\"3DUfw`\u00e2\ufffeL\u0003\u00fc4O\u001eO\u0002\u0178-\u203a\u00b7j.^a\u00cc\u000e?\u2013\u0016\u00f4a\u00da \u0011\u201dY\u0017\u00dc\u00ed\u0016b\b_CONSOLE .\u00f8\u0152\u00a4\u00c8\u0153\u00ab\u00e9 \u2030'\u00f1\u00cf\u00c6\u0018\u00eds\u00ff\u0003\u00e4\u2030\u00e2\u00a2TH\u00fb\u00b4\/\u00d2\u2020\u00b4&lt;\f\bbb\u00b77\u001fi\u00ec\u00d5<\/code>&#8220;, also without a solution.<\/p>\n\n\n\n<p><a href=\"https:\/\/superuser.com\/questions\/975695\/reading-encrypted-files-from-android-microsd-card\">https:\/\/superuser.com\/questions\/975695\/reading-encrypted-files-from-android-microsd-card<\/a> posted three examples, all also having at least the &#8220;<code>b._CONSOLE<\/code>&#8221; portion, Samsung Galaxy S3 device. No solution but a user commenting that &#8220;<em>This is related to Samsung Knox and these signatures are Samsung specific<\/em>&#8221; which seems unlikely as I am using a Sony device&#8230;<\/p>\n\n\n\n<p><strong>^ See the top of the post for my conclusion ^<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Conclusion: The files are encrypted with Android&#8217;s file-based encryption. The SD card is broken. The SD card is broken. The internet says it is typical for SD cards to go read-only as a symptom of fail. Trying to rsync or ddrescue the card&#8217;s contents using a separate devices led to stalls and read errors. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,12],"tags":[],"class_list":["post-1908","post","type-post","status-publish","format-standard","hentry","category-android","category-linux"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1908","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=1908"}],"version-history":[{"count":5,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions"}],"predecessor-version":[{"id":1916,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions\/1916"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=1908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=1908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=1908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}