14 July, 2014

TestDisk - a utility not for the faint-hearted

testdisk_Linux
testdisk_Linux (Photo credit: ignace72)
14-July-2014


A couple of months back, I made the mistake of installing Ubuntu Linux 14.04 over my Windows OS, and I lost a lot of files! Included in the list are my codes, my life's work of 15 years!

I was frantic to say the least, and I scampered to find the perfect utility that will help me in the file recovery. As suggested, I minimized booting into Ubuntu Linux, so the amount of probably unrecoverable files will be minimized. I understood that, and I heeded that suggestion.

Now, there were several that surfaced, but after trying those that I deemed useful, I ended up with TestDisk. As I found, it is not for the fainthearted. I had to run 3-4x before I finally got the hang of it. And yes, there is a GUI version, but I got  more comfortable with the text-based version. Of course, since what I have as a surviving OS is Linux, it is the Linux version that I was able to run.

Here's a list of what I have noted down, in case somebody would need them, intentionally or not. Some of these are listed as part of the help/instruction list. At any rate, here goes:

Press the corresponding keys, and what happens/effect
P - list files in directory
: - to make a selection
c - current file copy
C - copy selected files/directories
Left arrow key - to go back
Right arrow key - to change directory
. - (select single dot) go to parent directory
.. - (select double dot) move down (right arrow key?)
Shift + C - select device

Where are the copied files?
They are in /dev
Directory structure is retained (if that is ever a bonus!)

Linux Live has a limitation on file size, so copy by folder with about 4GB total size, or less. You may become too excited and just select all directories. Well, the copy function will (seem to) work, but it won't be able to go past the file size limit.

To remove copied files, and prepare for the next batch, type:
rm -rf [xxxxxx]
where [xxxxxx] is your filename (wildcards accepted)
Warning: rm -rf is quite powerful, so use with caution.

To list devices attached to computer, type:
ls -l /media

To copy (from /dev to your removable media/portable HDD), type:
cp -ar /dev/xxx /media/xxx/yyy/zzz

To remove temporary files, type:
1. cd /dev
2. rm -rf xxx

If you encounter input/output error, try below:
1. Exit Terminal where error occurred
2. Unmount affected destination drive (USB, HDD, etc); wait for unmount to properly complete
3. Unplug, then wait for 10 seconds or more
4. Plug back in
5. Reduce copied files


C'est t'out!

No comments:

Post a Comment