[mythtv-users] recovery of files and filenames from ext4 partition

Mark Perkins perkins1724 at hotmail.com
Tue Feb 3 09:13:14 UTC 2015



> On 3 Feb 2015, at 11:16 am, "Stephen Worthington" <stephen_agent at jsw.gen.nz> wrote:
> 
>> On Tue, 3 Feb 2015 09:54:33 +1030, you wrote:
>> 
>> Hi all, just looking to see if anyone has any specific advice / pointers for
>> me.
>> 
>> Had to do a reboot last night of Mythbackend (Ubuntu 14.04.01). On reboot
>> for some reason one of the 2Tb recording drives spat hundreds of SMART
>> errors and crashed and the backend didn't restart (Ubuntu didn't boot). It
>> took a little while before I realised things weren't coming back (was doing
>> this on essentially headless BE) but once I realised 'all is not well' and
>> got a monitor on it there was just a screen full of text errors.
>> 
>> Rebooted, and got the standard Ubuntu file system check which I let do it
>> its thing (bad idea but too late now) and everything came back up normally -
>> except the one recording drive has no files. It is correctly partitioned
>> (ext4) but is file-less / directory-less. No backups (it's just TV). Gparted
>> is showing the correct % full but there are no files / directories listed.
>> 
>> What are the suggestions for recovering files. The drive is a wreck, SMART
>> is showing it is a failure in progress (plus it 'squeals' now) but *for now*
>> it is working.
>> 
>> Essentially I have imaged the failed drive to image file on NAS (gddrescue).
>> Then tried recovery with foremost but it didn't find anything. Trying now
>> with photorec which appears to be working well - except it does not recover
>> file names which renders the recordings as useless until filenames are
>> manually corrected, not sure I can be bothered with that.
>> 
>> I'm not happy about it but life is like that. I'm certainly not unhappy
>> enough to spend the money on backups (it's just TV). Just wondered if there
>> were any other steps that others would recommended in this situation. In
>> particular - a file recovery program that would recover files + filenames on
>> an ext4 partition?
>> 
>> Thanks in advance!
> 
> One thing I have found very helpful when I have recovered files
> without any names is to use the file sizes to match the names to a
> catalog file that also has the sizes.  The mythconverg database stores
> the file sizes for recordings in the recorded.filesize field, so this
> SQL would give you a list of all the your recording files and the
> matching filenames in size order:
> 
> select filesize,basename from recorded order by filesize;
> 
> If you then do an ls -lS | sort -nk 5 command on your recovered
> recordings directory you will get a listing of those files in size
> order also to match against the database output.  The two listings
> merged can be used to create a script that would rename all the files
> to the correct names.  Let me know if you need any help with
> automating the process of creating the script.
> _______________________________________________

Thanks Stephen, yes I am thinking of something along those lines. It appears that testdisk is actually preserving file creation timestamps so that may be very useful as well. Will see what the quality of files looks like first and decide where to go next. Certainly the output of photorec appears to be sufficiently corrupted to make any further efforts pointless on that front.


More information about the mythtv-users mailing list