Recovering a deleted recording


Staff member
A recent discussion about whether it's possible to recover deleted recordings prompted me to give it a go this evening (there must be nothing on the tele!)

Of course, the undelete package is the right solution but here goes:

Delete two recordings from a test directory:
humax# ls /mnt/hd2/My\ Video/test/Peg\ \+\ Cat_20170212_11*
/mnt/hd2/My Video/test/Peg + Cat_20170212_1130.hmt
/mnt/hd2/My Video/test/Peg + Cat_20170212_1130.nts
/mnt/hd2/My Video/test/Peg + Cat_20170212_1130.thm
/mnt/hd2/My Video/test/Peg + Cat_20170212_1130.ts
/mnt/hd2/My Video/test/Peg + Cat_20170212_1147.hmt
/mnt/hd2/My Video/test/Peg + Cat_20170212_1147.nts
/mnt/hd2/My Video/test/Peg + Cat_20170212_1147.thm
/mnt/hd2/My Video/test/Peg + Cat_20170212_1147.ts
humax# rm /mnt/hd2/My\ Video/test/Peg\ \+\ Cat_20170212_11*

At this point I used the telnet menu to restart into maintenance mode and get back to the command line.
Once there, I made the video partition read-only so that there would be no further write activity, confirmed that the recordings were definitely gone then added 1GB of swap space from partition 3 (undelete is memory intensive):

humax# mount -o remount,ro /mnt/hd2
humax# ls -l /mnt/hd2/My\ Video/test
total 0

humax# dd if=/dev/zero of=/mnt/hd3/swap bs=1M count=1024
humax# mkswap /mnt/hd3/swap
humax# swapon /mnt/hd3/swap

Now to run the undelete. Need to change directory to somewhere writable to save the recovered files. I used /mnt/hd3 for this test but a USB stick or external disk would give more space if required:
humax# cd /mnt/hd3
humax# extundelete --restore-directory 'My Video/test' /dev/sda2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 29721 groups loaded.
Loading journal descriptors ... 29905 descriptors loaded.
Searching for recoverable inodes in directory My Video/test ...
11 recoverable inodes found.
Looking through the directory structure for deleted files ...
4 recoverable inodes still lost.
It took 5 minutes to run and in this case it recovered one recording but failed to retrieve the .ts file from the other:
humax# find RECOVERED_FILES/
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1147.nts
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1147.ts
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1130.hmt
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1147.hmt
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1130.nts
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1130.thm
RECOVERED_FILES/My Video/test/Peg + Cat_20170212_1147.thm

and the recovered recording plays!

So, it is possible but obviously there are no guarantees.