Skip to content

Instantly share code, notes, and snippets.

@FliegendeWurst
Last active July 1, 2021 16:09
Show Gist options
  • Save FliegendeWurst/6548c71a0f21a60183dbdd2bb7be16db to your computer and use it in GitHub Desktop.
Save FliegendeWurst/6548c71a0f21a60183dbdd2bb7be16db to your computer and use it in GitHub Desktop.
Panasonic Viera TV TX40CSW614W recordings index recovery

I recently got this error message: "keine gΓΌltige Datei gefunden" β‰ˆ "no valid file found"
when trying to view the recordings on my Panasonic TV (model TX40CSW614W).
Apparently you really have to "safely remove" the drive before unplugging it..

The above error only affected one of my drives ("WD2"), the other one ("WD1") still works fine.

So I investigated whether the recordings can be recovered and learned the following:

A properly formatted drive should contain two partitions:

  • Partition 1: size: 1GB, filesystem: UFS
  • Partition 2: size: remaining space on HDD, unknown filesystem

The first partition is easily inspected:

> sudo mkdir /tmp/WD1
> sudo mount -t ufs -o ro,ufstype=ufs2 /dev/sdd1 /tmp/WD1
> sudo mkdir /tmp/WD2
> sudo mount -t ufs -o ro,ufstype=ufs2 /dev/sde1 /tmp/WD2

File listing of the working drive:

> sudo ls -lah WD1
[...]
-rw-r-----  1 root root 159K Jan 12  2017 832_00.aid
-rw-r-----  1 root root    8 Jan 11  2017 832_00.pmt
-rw-r-----  1 root root 159K Jan 12  2017 832_00.vid
-rw-r-----  1 root root  484 Jan 12  2017 832.chp
-rw-rw-rw-  1 root root   16 Jan 12  2017 832.rsp
-rw-r-----  1 root root 182K Feb  6  2017 895_00.aid
-rw-r-----  1 root root    8 Feb  6  2017 895_00.pmt
-rw-r-----  1 root root 182K Feb  6  2017 895_00.vid
-rw-r-----  1 root root  556 Feb  6  2017 895.chp
-rw-rw-rw-  1 root root   16 Feb  7  2017 895.rsp
-rw-r-----  1 root root 189K MΓ€r 13  2017 979_00.aid
-rw-r-----  1 root root    8 MΓ€r 13  2017 979_00.pmt
-rw-r-----  1 root root 189K MΓ€r 13  2017 979_00.vid
-rw-r-----  1 root root  916 MΓ€r 13  2017 979.chp
-rw-rw-rw-  1 root root   16 MΓ€r 13  2017 979.rsp
-rw-r--r--  1 root root   32 Apr 28  2016 d0
-rw-r-----  1 root root    8 Mai 29 04:03 d1
-rw-r--r--  1 root root   25 Apr 28  2016 d3
-rw-r-----  1 root root    4 Mai 29 04:04 d4
-rw-rw-rw-  1 root root    4 Mai 28 21:17 d5
drwxr-x---  2 root root 7,0K Mai 29 04:20 edt
drwx------  2 root root 4,0K Jan  5 21:16 lost+found
drwxrwxr-x  2 root root  512 Apr 28  2016 .snap
drwxrwxrwx  2 root root 3,5K Mai 29 04:20 thum

File listing of the 'broken' drive:

> sudo ls -lah WD2
[...]
-rw-r-----  1 root root 133K Aug  9  2020 74_00.aid
-rw-r-----  1 root root    8 Aug  9  2020 74_00.pmt
-rw-r-----  1 root root 133K Aug  9  2020 74_00.vid
-rw-r-----  1 root root  652 Aug  9  2020 74.chp
-rw-rw-rw-  1 root root   16 Aug 22  2020 74.rsp
-rw-r-----  1 root root 114K Aug 29  2020 94_00.aid
-rw-r-----  1 root root    8 Aug 28  2020 94_00.pmt
-rw-r-----  1 root root 114K Aug 29  2020 94_00.vid
-rw-r-----  1 root root  676 Aug 29  2020 94.chp
-rw-rw-rw-  1 root root   16 Aug 29  2020 94.rsp
-rw-r-----  1 root root  90K Sep  1  2020 98_00.aid
-rw-r-----  1 root root    8 Aug 31  2020 98_00.pmt
-rw-r-----  1 root root  90K Sep  1  2020 98_00.vid
-rw-r-----  1 root root  604 Sep  1  2020 98.chp
-rw-rw-rw-  1 root root   16 Sep  2  2020 98.rsp
-rw-r--r--  1 root root   32 Mai 21  2020 d0
-rw-r-----  1 root root    8 Mai  7 19:38 d1
-rw-r--r--  1 root root   25 Mai 21  2020 d3
-rw-r-----  1 root root    4 Mai 10 22:51 d4
-rw-rw-rw-  1 root root    4 Apr 30 22:19 d5
drwx------  3 root root 4,0K Jan  9 20:58 lost+found
drwxrwxr-x  2 root root  512 Mai 21  2020 .snap
drwxr-x---  2 root root 1,5K Mai 10 22:51 thum

Notice that the edt directory is missing. Let's see what it should contain (by looking at the working drive):

> sudo ls -lah WD1/edt
drwxr-x--- 2 root root 7,0K Mai 29 04:20 .
drwxr-xr-x 6 root root  18K Mai 29 04:20 ..
[...]
-rw-r----- 1 root root  464 Jan 11  2017 832.dat
-rw-r----- 1 root root  280 Jan 12  2017 832.dt2
-rw-r----- 1 root root  464 Feb  6  2017 895.dat
-rw-r----- 1 root root  280 Feb  7  2017 895.dt2
-rw-r----- 1 root root  464 MΓ€r 13  2017 979.dat
-rw-r----- 1 root root  280 MΓ€r 13  2017 979.dt2

Each dt2/dat pair contains metadata (title + misc. encrypted (?) data) on one recording:

> sudo cp /tmp/WD1/edt/3099.dt2 aaa; hexyl aaa
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚00000000β”‚ 00 01 10 00 00 00 03 c0 β”Š 00 00 00 00 00 00 00 00 β”‚0β€’β€’000β€’Γ—β”Š00000000β”‚
β”‚00000010β”‚ 01 44 75 72 63 68 20 64 β”Š 61 73 20 4a 61 68 72 20 β”‚β€’Durch dβ”Šas Jahr β”‚
β”‚00000020β”‚ 69 6e 20 64 65 72 20 77 β”Š 65 6c 74 77 65 69 74 65 β”‚in der wβ”Šeltweiteβ”‚
β”‚00000030β”‚ 6e 20 57 69 6c 64 6e 69 β”Š 73 00 00 00 00 00 00 00 β”‚n Wildniβ”Šs0000000β”‚
β”‚00000040β”‚ 00 00 00 00 00 00 00 00 β”Š 00 00 00 00 00 00 00 00 β”‚00000000β”Š00000000β”‚
β”‚*       β”‚                         β”Š                         β”‚        β”Š        β”‚
β”‚00000110β”‚ 00 00 00 00 00 00 00 00 β”Š                         β”‚00000000β”Š        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
> sudo cp /tmp/WD1/edt/3099.dat aaa; hexyl aaa    
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚00000000β”‚ b2 43 ff 93 66 79 50 f4 β”Š ac 44 fa a0 0b ad eb 73 β”‚Γ—CΓ—Γ—fyPΓ—β”ŠΓ—DΓ—Γ—β€’Γ—Γ—sβ”‚
β”‚00000010β”‚ 66 2c 83 df 16 2a 60 6e β”Š d6 8c f2 d4 49 2b bd 42 β”‚f,Γ—Γ—β€’*`nβ”ŠΓ—Γ—Γ—Γ—I+Γ—Bβ”‚
β”‚00000020β”‚ 70 e7 07 8b ba 7a b7 1a β”Š 7d 1e bb 1a 98 e7 84 a7 β”‚pΓ—β€’Γ—Γ—zΓ—β€’β”Š}β€’Γ—β€’Γ—Γ—Γ—Γ—β”‚
β”‚00000030β”‚ f8 bb 56 e4 37 44 8a 9e β”Š 09 8e 44 f4 a2 2a 46 d4 β”‚Γ—Γ—VΓ—7DΓ—Γ—β”Š_Γ—DΓ—Γ—*FΓ—β”‚
β”‚00000040β”‚ a0 2e 6a 1a 14 e3 d9 95 β”Š ea 65 1e 5b b7 aa 53 87 β”‚Γ—.jβ€’β€’Γ—Γ—Γ—β”ŠΓ—eβ€’[Γ—Γ—SΓ—β”‚
β”‚00000050β”‚ 74 ec ee 28 4a 86 c5 de β”Š c0 ba 16 b4 a8 28 60 df β”‚tΓ—Γ—(JΓ—Γ—Γ—β”ŠΓ—Γ—β€’Γ—Γ—(`Γ—β”‚
β”‚00000060β”‚ f6 8b c5 6e 17 d9 70 95 β”Š 42 9f 4e d1 9a 43 51 c8 β”‚Γ—Γ—Γ—nβ€’Γ—pΓ—β”ŠBΓ—NΓ—Γ—CQΓ—β”‚
β”‚00000070β”‚ 85 08 d6 fc 50 5d 6f c6 β”Š 42 64 61 fb 16 06 e6 c6 β”‚Γ—β€’Γ—Γ—P]oΓ—β”ŠBdaΓ—β€’β€’Γ—Γ—β”‚
β”‚00000080β”‚ b2 9a b8 0b aa 91 9d 52 β”Š 53 cb 24 2e b4 32 03 f9 β”‚Γ—Γ—Γ—β€’Γ—Γ—Γ—Rβ”ŠSΓ—$.Γ—2β€’Γ—β”‚
β”‚00000090β”‚ 54 71 43 61 7d 30 37 7e β”Š 88 ee 04 b7 02 93 40 8e β”‚TqCa}07~β”ŠΓ—Γ—β€’Γ—β€’Γ—@Γ—β”‚
β”‚000000a0β”‚ af b6 7f 21 64 49 e5 cb β”Š 89 e0 f7 72 97 db 3f 37 β”‚Γ—Γ—β€’!dIΓ—Γ—β”ŠΓ—Γ—Γ—rΓ—Γ—?7β”‚
β”‚000000b0β”‚ 80 26 ab 6f 28 b1 bd 25 β”Š ca 59 4b c1 3d 6d 7d f8 β”‚Γ—&Γ—o(Γ—Γ—%β”ŠΓ—YKΓ—=m}Γ—β”‚
β”‚000000c0β”‚ 64 ce 52 1c f5 bf 55 d8 β”Š d8 6f 8f ab e3 e2 98 b6 β”‚dΓ—Rβ€’Γ—Γ—UΓ—β”ŠΓ—oΓ—Γ—Γ—Γ—Γ—Γ—β”‚
β”‚000000d0β”‚ 47 5c 4e ff cc 8c ea c4 β”Š 3b 92 d8 45 9e b0 8a 5a β”‚G\NΓ—Γ—Γ—Γ—Γ—β”Š;Γ—Γ—EΓ—Γ—Γ—Zβ”‚
β”‚000000e0β”‚ f2 97 5d e5 e7 68 e9 b2 β”Š 36 f5 2a 5d 10 78 16 1f β”‚Γ—Γ—]Γ—Γ—hΓ—Γ—β”Š6Γ—*]β€’xβ€’β€’β”‚
β”‚000000f0β”‚ 2e 28 5b 9c a2 c2 7d 1d β”Š 5c eb bb 64 c0 b9 30 79 β”‚.([Γ—Γ—Γ—}β€’β”Š\Γ—Γ—dΓ—Γ—0yβ”‚
β”‚00000100β”‚ 12 13 a2 2a d7 d2 5f 7d β”Š 5f 1e e8 8f 7e ab 77 da β”‚β€’β€’Γ—*Γ—Γ—_}β”Š_β€’Γ—Γ—~Γ—wΓ—β”‚
β”‚00000110β”‚ b5 db a0 41 78 b0 c5 b8 β”Š 98 5e 84 58 ec d9 ee 52 β”‚Γ—Γ—Γ—AxΓ—Γ—Γ—β”ŠΓ—^Γ—XΓ—Γ—Γ—Rβ”‚
β”‚00000120β”‚ 8e eb f6 50 41 74 eb 0d β”Š b7 ea f9 46 32 04 5e 9b β”‚Γ—Γ—Γ—PAtΓ—_β”ŠΓ—Γ—Γ—F2β€’^Γ—β”‚
β”‚00000130β”‚ b6 58 5a 27 cf 26 29 25 β”Š 93 78 e5 1c 4d 85 5b 02 β”‚Γ—XZ'Γ—&)%β”ŠΓ—xΓ—β€’MΓ—[β€’β”‚
β”‚00000140β”‚ f9 53 2f ff 2c 20 62 05 β”Š 48 b4 76 99 53 ed fe a4 β”‚Γ—S/Γ—, bβ€’β”ŠHΓ—vΓ—SΓ—Γ—Γ—β”‚
β”‚00000150β”‚ bb 5c df f8 27 7c a2 ab β”Š a5 d5 5d 09 70 97 e1 ba β”‚Γ—\Γ—Γ—'|Γ—Γ—β”ŠΓ—Γ—]_pΓ—Γ—Γ—β”‚
β”‚00000160β”‚ e6 39 33 50 92 60 3c 72 β”Š 10 0b a8 66 ee 17 4d 46 β”‚Γ—93PΓ—`<rβ”Šβ€’β€’Γ—fΓ—β€’MFβ”‚
β”‚00000170β”‚ 0e 01 68 e9 f4 54 41 c7 β”Š ce 06 89 5e 63 16 d7 53 β”‚β€’β€’hΓ—Γ—TAΓ—β”ŠΓ—β€’Γ—^cβ€’Γ—Sβ”‚
β”‚00000180β”‚ b2 54 a0 49 87 90 81 13 β”Š f2 e9 d1 d0 4f e7 aa 63 β”‚Γ—TΓ—IΓ—Γ—Γ—β€’β”ŠΓ—Γ—Γ—Γ—OΓ—Γ—cβ”‚
β”‚00000190β”‚ 01 70 c5 6e 27 2c 7f 59 β”Š b7 ea 65 79 6d d1 73 0a β”‚β€’pΓ—n',β€’Yβ”ŠΓ—Γ—eymΓ—s_β”‚
β”‚000001a0β”‚ 9c ea 93 53 01 f5 8b 2c β”Š 37 ba 79 d9 e4 61 dc bf β”‚Γ—Γ—Γ—Sβ€’Γ—Γ—,β”Š7Γ—yΓ—Γ—aΓ—Γ—β”‚
β”‚000001b0β”‚ e4 44 78 71 6e 16 5c cb β”Š 72 53 e2 95 c7 56 9d 91 β”‚Γ—Dxqnβ€’\Γ—β”ŠrSΓ—Γ—Γ—VΓ—Γ—β”‚
β”‚000001c0β”‚ 83 c4 c8 b7 85 e3 b4 86 β”Š 09 ab 9b 7d ce af f8 2e β”‚Γ—Γ—Γ—Γ—Γ—Γ—Γ—Γ—β”Š_Γ—Γ—}Γ—Γ—Γ—.β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

So we'll definitely need to recover these files somehow. Luckily, the lost+found directory already contains some of them:

> sudo ls -lah WD2/lost+found
total 192K
drwx------ 3 root root 4,0K Jan  9 20:58  .
drwxr-xr-x 5 root root 5,0K Mai 28 21:53  ..
-rw-r----- 1 root root  464 Jun 11  2020 '#00012'
-rw-r----- 1 root root  464 Nov 14  2020 '#00015'
-rw-r----- 1 root root  464 Dez 13 00:09 '#00021'
-rw-r----- 1 root root  464 Aug 28  2020 '#00022'
-rw-r----- 1 root root  464 Nov 29 22:25 '#00030'
-rw-r----- 1 root root  464 Dez 19 22:05 '#00040'
-rw-r----- 1 root root  464 Dez 23 22:12 '#00041'
-rw-r----- 1 root root  464 Jun 14  2020 '#00046'
-rw-r----- 1 root root  464 Aug  9  2020 '#00047'
-rw-r----- 1 root root  464 Mai 30  2020 '#00050'
-rw-r----- 1 root root  464 Jun 11  2020 '#00055'
-rw-r----- 1 root root  464 Sep 13  2020 '#00056'
-rw-r----- 1 root root  464 Aug 31  2020 '#00072'
-rw-r----- 1 root root  464 Jul 25  2020 '#00090'
-rw-r----- 1 root root  464 Dez 19 20:15 '#00094'
-rw-r----- 1 root root  464 Jun 16  2020 '#00099'
-rw-r----- 1 root root  464 Sep  1  2020 '#00138'
-rw-r----- 1 root root  464 Sep  6  2020 '#00153'
-rw-r----- 1 root root  464 MΓ€r 27 20:12 '#00156'
-rw-r----- 1 root root  464 Feb 13 01:44 '#00165'
-rw-r----- 1 root root  464 Dez 25 20:12 '#00167'
-rw-r----- 1 root root  464 Sep  8  2020 '#00173'
-rw-r----- 1 root root  464 Dez 25 21:40 '#00178'
-rw-r----- 1 root root  464 Feb 13 23:26 '#00183'
-rw-r----- 1 root root  464 Feb 14 20:15 '#00185'
-rw-r----- 1 root root  464 Mai  6 20:12 '#00192'
-rw-r----- 1 root root  464 Sep 17  2020 '#00199'
[...]

The file size (464 bytes) suggests these are the .dat files.
And the modification dates actually correspond to the recording start times! (NB: you have to know what you recorded at those times to actually recover anything later)

Copy the found files over:

> sudo cp --archive -r WD2/lost+found /tmp
> sudo chmod +rx lost+found
> sudo chmod +r -R lost+found

Next up we'll copy the entire partition:

> sudo dd if=/dev/sde1 of=/tmp/WD2.img bs=8M status=progress

To look for .dt2 remains using my script (see the other files in this gist):

> git clone <URL of this gist>
> cd <newly created directory>
> mkdir src && mv main.rs src
> cargo run --release -- /tmp/WD2.img

This will output each recording found and a results directory will be created, containing all found .dt2 files:

> exa -lah
Permissions Size User Date Modified    Name
.rw-r--r--   280 arne 2021-05-30 11:04 41. Weltfestival des Zirkus von Morgen_281600000
.rw-r--r--   280 arne 2021-05-30 11:04 Alice im Wunderland: Hinter den Spiegeln_270774272
.rw-r--r--   280 arne 2021-05-30 11:04 Ancien und das magische KΓΆnigreich_281636864
.rw-r--r--   280 arne 2021-05-30 11:04 Ant-Man_281575424
.rw-r--r--   280 arne 2021-05-30 11:04 Arthur Weihnachtsmann_281559040
.rw-r--r--   280 arne 2021-05-30 11:04 Avengers: Infinity War_281640960
.rw-r--r--   280 arne 2021-05-30 11:04 Begabt  Die Gleichung eines Lebens_281518080
.rw-r--r--   280 arne 2021-05-30 11:04 Bibi & Tina: Tohuwabohu total_281493504
.rw-r--r--   280 arne 2021-05-30 11:04 Birdman_281628672
.rw-r--r--   280 arne 2021-05-30 11:04 Challenger  Ein Mann kΓ€mpft fΓΌr die Wahrheit_281632768
.rw-r--r--   280 arne 2021-05-30 11:04 Cirque du Soleil  Amaluna_281604096
.rw-r--r--   280 arne 2021-05-30 11:04 Das Geheimnis der BΓ€ume_281649152
.rw-r--r--   280 arne 2021-05-30 11:04 Das Wikipedia Versprechen_270778368
.rw-r--r--   280 arne 2021-05-30 11:04 Der Trafikant_281505792
.rw-r--r--   280 arne 2021-05-30 11:04 Die Lebenden reparieren_281645056
.rw-r--r--   280 arne 2021-05-30 11:04 Die Truman-Show_281542656
.rw-r--r--   280 arne 2021-05-30 11:04 Die Unfassbaren 2  Now You See Me_17657856
.rw-r--r--   280 arne 2021-05-30 11:04 Die Unfassbaren 2  Now You See Me_270770176
.rw-r--r--   280 arne 2021-05-30 11:04 Fuxia, die Minihexe_281489408
.rw-r--r--   280 arne 2021-05-30 11:04 Herbstmilch_281620480
[...]

Now it's time to take your list of recordings and start matching up timestamps!

Below, I initially copyed the lost+found listing (sorted by: exa -l --sort date lost+found). Next I added the titles on the right. Finally I added the recording IDs on the left (using the /tmp/WD2 listing). Given that I forgot to write down the recording times of a few shows, some final guesswork/research was neccessary.

16 .rw-r--r-- 464 root 2020-05-30 20:12 #00050 Mein wildes Herz
23 .rw-r--r-- 464 root 2020-06-11 07:02 #00012 Fuxia
24 .rw-r--r-- 464 root 2020-06-11 16:44 #00055 Bibi & Tina
28 .rw-r--r-- 464 root 2020-06-14 22:26 #00046 Oceans 13
32 .rw-r--r-- 464 root 2020-06-16 20:12 #00099 Sharktopus
63 .rw-r--r-- 464 root 2020-07-24 20:15 #00211 Interstellar
64 .rw-r--r-- 464 root 2020-07-25 20:12 #00090 Begabt
71 .rw-r--r-- 464 root 2020-08-02 20:12 #00241 Passengers
74 .rw-r--r-- 464 root 2020-08-09 00:19 #00047 Alice im Wunderland
94 .rw-r--r-- 464 root 2020-08-28 22:23 #00022 Terminator
98 .rw-r--r-- 464 root 2020-08-31 22:12 #00072 The Accountant
101 .rw-r--r-- 464 root 2020-09-01 20:12 #00138 Truman Show
108 .rw-r--r-- 464 root 2020-09-06 06:57 #00153 ! programm.ard.de ! Peter Lindbergh_281554944
112 .rw-r--r-- 464 root 2020-09-08 20:12 #00173 Tropic Thunder
120 .rw-r--r-- 464 root 2020-09-13 20:12 #00056 La La Land
128 .rw-r--r-- 464 root 2020-09-17 00:01 #00199 Meine schΓΆne innere Sonne
155 .rw-r--r-- 464 root 2020-11-14 20:15 #00015 Star Trek Into Darkness
161 .rw-r--r-- 464 root 2020-11-29 22:25 #00030 Ant Man
172 .rw-r--r-- 464 root 2020-12-13 00:09 #00021 Der Trafikant ??
180 .rw-r--r-- 464 root 2020-12-19 20:15 #00094 Arthur Weihnachtsmann
181 .rw-r--r-- 464 root 2020-12-19 22:05 #00040 ! letzter ΓΌbriger Film ! Kevin, Allein gegen alle_281587712
187 .rw-r--r-- 464 root 2020-12-23 22:12 #00041 PlΓΆtzich Santa
190 .rw-r--r-- 464 root 2020-12-25 20:12 #00167 41. Weltfestival Zirkus von Morgen
191 .rw-r--r-- 464 root 2020-12-25 21:40 #00178 ! programm.ard.de ! Cirque du Soleil  Amaluna_281604096
203 .rw-r--r-- 464 root 2020-12-29 23:35 #00276 Birdman
207 .rw-r--r-- 464 root 2021-01-01 20:12 #00289 Jim Knopf
208 .rw-r--r-- 464 root 2021-01-01 23:16 #00272 Mamma Mia
210 .rw-r--r-- 464 root 2021-01-03 20:12 #00223 The Avengers Infinity War
.r-xr--r--   0 root 2021-01-05 21:15 #16675 ?!
215 .rw-r--r-- 464 root 2021-01-11 23:37 #00260 ! mediathek ! Das Wikipedia Versprechen_270778368
231 .rw-r--r-- 464 root 2021-01-22 20:12 #00258 Ancien
237 .rw-r--r-- 464 root 2021-02-05 20:15 #00270 Wie ich lernte, bei mir selbst Kind zu sein
242 .rw-r--r-- 464 root 2021-02-13 01:44 #00165 Wilde Maus
243 .rw-r--r-- 464 root 2021-02-13 23:26 #00183 Men In Black 2
244 .rw-r--r-- 464 root 2021-02-14 20:15 #00185 William Shakespeares Romeo und Julia
248 .rw-r--r-- 464 root 2021-02-17 20:13 #00285 Meeresleuchten
251 .rw-r--r-- 464 root 2021-02-20 00:42 #00308 Mit Siebzehn
254 .rw-r--r-- 464 root 2021-02-21 23:40 #00250 Herbstmilch
257 .rw-r--r-- 464 root 2021-02-23 18:30 #00261 Portugal
260 .rw-r--r-- 464 root 2021-02-23 22:55 #00248 Die Lebenden reparieren
262 .rw-r--r-- 464 root 2021-02-24 20:14 #00314 ! programm.ard.de ! Das Geheimnis der BΓ€ume_281649152
266 .rw-r--r-- 464 root 2021-02-26 20:16 #00202 VΓ€ter allein zu Haus
.r-xr--r--   0 root 2021-03-21 21:36 #16663 ?!
275 .rw-r--r-- 464 root 2021-03-27 00:40 #00206 Challenger
276 .rw-r--r-- 464 root 2021-03-27 20:12 #00156 Maria Stewart
282 .rw-r--r-- 464 root 2021-05-06 20:12 #00192 Die Unfassbaren 2
.r-xr--r--   0 root 2021-05-07 23:26 #16664
drwxr-xr--   - root 2021-05-28 21:53 #08320 (edt directory?)

If the script found too many recordings, check whether they're deleted by looking for three null bytes (_00 00 00_ below):

> hexyl Wissen\ vor\ acht\ -\ Natur_20078592                          
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚00000000β”‚ 00 01 10 00 00 00 02 63 β”Š 00_00 00 00_00 00 00 00 β”‚0β€’β€’000β€’cβ”Š00000000β”‚
β”‚00000010β”‚ 01 57 69 73 73 65 6e 20 β”Š 76 6f 72 20 61 63 68 74 β”‚β€’Wissen β”Švor achtβ”‚
β”‚00000020β”‚ 20 2d 20 4e 61 74 75 72 β”Š 00 00 00 00 00 00 00 00 β”‚ - Naturβ”Š00000000β”‚
β”‚00000030β”‚ 00 00 00 00 00 00 00 00 β”Š 00 00 00 00 00 00 00 00 β”‚00000000β”Š00000000β”‚
β”‚*       β”‚                         β”Š                         β”‚        β”Š        β”‚
β”‚00000110β”‚ 00 00 00 00 00 00 00 00 β”Š                         β”‚00000000β”Š        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

This indicates that the recording was deleted. You can ignore such .dt2 files.

After that, copy all of the .dat files to the results directory:

> cp /tmp/lost+found/\#00050 viera_recording_recovery/results/16.dat
[...]

Rename the found .dt2 files:

> mv 'Mein wildes Herz - Alles auf Sieg_281481216' 16.dt2
[...]

Now we'll have to modify the UFS partition.
This can be accomplished using a Knoppix live system: (do not try using FreeBSD, it probably won't work)

> sudo dd if=Downloads/KNOPPIX_V9.1DVD-2021-01-25-EN.iso of=/dev/sdf oflag=direct bs=4M status=progress

Copy the recovered files (and the partition image) to another USB drive:

> cp *.dat *.dt2 [USB drive]
> cp WD2.img [USB drive]

Boot Knoppix and press Ctrl+Alt+F1 to get a command line.

> mount /dev/sdc1 /media/sdc1
> mkdir WD
> mount -t ufs -o ufstype=ufs2,loop,rw,sync /media/sdc1/WD2.img WD
> mkdir WD/edt
> cp /media/sdc1/*.dat WD/edt
> cp /media/sdc1/*.dt2 WD/edt
> sync
> umount WD
> sync
> umount /media/sdc1
> sync

Now copy the disk image on the drive:

> sudo umount /tmp/WD2
> sudo dd if=[USB drive]/WD2.img of=/dev/sde1 bs=2M oflag=direct status=progress
> sync

Unplug the drive and attach it to your TV. It should show your recordings again!

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "libc"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36"
[[package]]
name = "memchr"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "mmarinus"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4292fdc86ee9ad9f76be643d0ced05f28ff8b1d20653876a06f5937f778fd87e"
dependencies = [
"libc",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "viera_recording_recovery"
version = "0.1.0"
dependencies = [
"mmarinus",
"regex",
]
[package]
name = "viera_recording_recovery"
version = "0.1.0"
edition = "2018"
license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
mmarinus = "0.2.0"
regex = "1"
use std::{env, fs::{self, File}};
use mmarinus::{Kind, Map, perms};
use regex::bytes::Regex;
fn main() {
let mut args = env::args_os();
let mut disk_image = File::open(args.nth(1).unwrap()).unwrap();
let size = disk_image.metadata().map(|x| x.len()).unwrap();
let mmap = Map::map(size as usize)
.anywhere()
.from(&mut disk_image, 0)
.known::<perms::Read>(Kind::Private)
.unwrap();
// [^\x00]{5, 60}
// 00 01 10 00 00 00 30 A5 00 BB C2 68 _00 00 00 00_ 00 _49 6E 74 65 72 73 74 65 6C 6C 61 72_
let regex = Regex::new(r"(?-u)\x00\x01\x10\x00\x00\x00......\x00{4}.(?P<name>[^\x00]+)").unwrap();
let _ = fs::create_dir("results");
for m in regex.captures_iter(&mmap) {
let name = m.name("name").unwrap().as_bytes();
if name == &[1, 0x10, 0x10] {
continue;
}
let name = String::from_utf8_lossy(m.name("name").unwrap().as_bytes());
println!("{}", name);
let mut all = m.get(0).unwrap().as_bytes().to_vec();
while all.len() < 280 {
all.push(0);
}
fs::write(format!("results/{}_{}", name, m.get(0).unwrap().start()), &all).unwrap();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment