How to recover corrupted text file / lost clusters- USB driv

Using applications, configuring, problems
Message
Author
User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

How to recover corrupted text file / lost clusters- USB driv

#1 Post by canbyte »

Created/ edited a text file using geany. About 80k, Simple name (name.txt), on flash drive sdd1. pmount says sdd1 is 4005 mb vfat 3.7g/328m. Presumably the last number is the free space.

On trying to open this file, Geany and leafpad both give this error message: 'Failed to read from filename. Input/output error'.

Abiword shuts down, no message.

Fortunately, the Firefox (Nighttly) browser opened the file although it has been truncated so much work has been lost.

I pasted the contents into geany but when I tried to save to a copy of the file (filename2.txt) - it says 'Error opening filename: Read only file system. The file on disk may now be truncated. Changed name to filename3.txt and got same message.

Nightly won't save the file either. Tried saving another page - got a similar message:

'Filename could not be saved because the disk, folder or file is write-protected. Write-enable the disk and try again, or try saving in a different location.'

Tried saving to another flash drive with same result.


Geany did save to root/my-documents, after which it also saved to mnt/home (sdc1). The file is only 15k so over 60k disappeared somewhere.

Not sure what is happening - never happened before. But I'm beginning to wonder - since the truncation happened in the middle of a quoted paragraph from an online version of a newspaper, might there have been a buried code to protect copyright? Is this possible? or reasonable? It's a smallish regional newspaper and the file has been successfully saved and opened quite a few times since I pasted the quotation.

Another possibility is that yesterday, I was organizing bookmarks in Windows and exported them to an html file. Would it have overwritten the subject file? At some point i had tried to open the file with wordpad without success but can't remember the error message.

Does puppy have a scandisk function? Will it save lost clusters? Or maybe I should let windows try to recover? I'd really like to recover the lost work. Thanks in advance for any suggestions.
Last edited by canbyte on Wed 31 Oct 2012, 21:21, edited 1 time in total.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#2 Post by Barkin »

canbyte wrote: .. Does puppy have a scandisk function? Will it save lost clusters?
The recovery tools testdisk & photorec are available for puppy ...

http://www.murga-linux.com/puppy/viewtopic.php?t=79912

I'm not hopeful these tools would solve your problem, but they are useful to have anyway.

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#3 Post by canbyte »

Hi Barkin. It certainly sounds like it should recover whatever lost clusters are recoverable but I can't get it to start up so I'll post more details on the murga link you provided. Thanks.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#4 Post by Barkin »

There is a page on TestDisk on the Puppy wiki which includes links to dependencies which must be present for it to work ... http://puppylinux.org/wikka/TestDisk

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#5 Post by canbyte »

Hi Barkin, sorry to be a noob but I don't know what a dependancy is or what to do about it.

I also see that sdd1 won't mount but pmount comes up and gives the option to (un)mount - which then produces an error message - unable to mount. So now I'm really concerned about losing everything on the drive. Ouch.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#6 Post by Sylvander »

See...
Anyone know how to use ddrescue [NOT dd_rescue]?

You may be able to use ddrescue to clone from the suspect Flash Drive to a known good one [or any handy storage device?]
ddrescue uses its own code to DIRECTLY access the hardware.
Hence, when it hits trouble it doesn't crash the OS, just the ddrescue program, which is really easy to resume [it automatically resumes from where it crashed by using its log file].

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#7 Post by canbyte »

Well, Barkin will be happy I finally noticed that the link he gave contained a .pet file of slightly older version, so the dependency problem went away.

The post at the following link describes my effort to use testdisk to no avail although i stopped short of the write operation since I couldn't figure out the file choices and I didn't want to ruin any chances for later rescue.
http://www.murga-linux.com/puppy/viewto ... b6a3bcade6.

In trying to use Sylvander's suggested ddrescue, I've followed directions in the install file to the point it is unzipped but can't get the make command to work (from urxvt in ddrecover's directory) . Just says 'bash: make: command not found.'

I notice that the urxvt has a white background here whereas it had a black background when run by testdisk, which was one of my difficulties last evening (black on black).

Does bash use a different command for make or where am I going wrong?
Edit: I realized that the make command requires devx to operate - would need to dowload the sfs file and put in bootloader. Hoping to avoid all that.
Thanks.
Last edited by canbyte on Wed 31 Oct 2012, 23:40, edited 1 time in total.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#8 Post by Sylvander »

canbyte wrote:I've followed directions in the install file to the point it is unzipped but can't get the make command to work.
Why not just install the copy of ddrescue included in the Puppy Package Manager?

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#9 Post by canbyte »

I've just checked Slacko 533 package manager and no sign of any ddrescue in the list. Can you point me to the url it downloads from or what Puppy are you using? Thanks.

Edit; Search found a .pet here (v1.13)
http://www.murga-linux.com/puppy/viewtopic.php?t=33521

I downloaded and installed, now looking for how to run it (no menu entry), Found ddrescue (gear icon in /usr/bin.)

It is asking for source and destination and offering --help. Which I call up and realize I'm in way over my head.

What i suspect i'll get is rows and rows of block numbers, meaningless to me.
What I was hoping for was numerous files of lost clusters full of text that I (noob) would recognize and be able to piece together to recreate my original thoughts. Something like scandisk or chkdisk in windows.

fwiw, here is the output once it got working:
rescued 0B, errsize: 16384B, ipos 15360B, errors: 1, opos 15360B, Finished.
Log file had nothing in it.

any suggestions?
Last edited by canbyte on Thu 01 Nov 2012, 16:50, edited 1 time in total.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#10 Post by Sylvander »

1. See below a screenshot of the ddrescue version found [and I installed] in the list of repositories I chose within my Slacko-5.3.3.1-SCSI Puppy version.

2. I run it by typing a ddrescue command in a terminal.

3. Could you show here the command you used?
Use the commands I gave as a guide, but modify to suit your situation.
You need to specify the source [your problem Flash drive] and the destination [a 2nd Flash Drive?]

4. The output given by your ddrescue, and quoted by you:
(a) rescued 0B
This says that zero Bytes [0B] were rescued.
I'd need to know the command that produced that result.
Either the drive is faulty, and ddrescue was unable to rescue anything with a good command, or else the command was bad.
(b) errsize: 16384B
This shows that the error size was 16,384 Bytes [the total size of the Flash Drive?]
.
Attachments
00.jpg
(12.19 KiB) Downloaded 1636 times

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#11 Post by canbyte »

Hi Sylvander
I think my effort is going off the rails. Now I can't even get the package manager to come up. I click slickpet, go to more pets menu and click Puppy Package Manager (PPM). A brief orange box appears for a millisecond then is gone. Trying to access from the desktop menu - Setup/Setup Puppy/ P P M has the same effect. When i was able to access it last evening, I don't recall seeing the sceenshot you gave with the selection bullets across the top. I looked carefully at the choices available - no ddrescue. You have the 533-SCSI which may be different from my version which i think was just the standard 533?? However, my wife does have some uncomplimentary things to say about my ability to see what's in front of me!

Not sure what has caused PPM to malfunction but maybe I clicked on it too many times in my usual impatient modus operendi!! Any easy fix for that or do I have to re-install puppy from the beginning?

An old copy of the one important corrupted file turned up so I'm only missing a page or so in one project which could be recreated more or less. In addition, the aforesaid impatience got the better of me last evening and i tried letting windows xp try a recovery so I've probably erased whatever was left. Can't recall the name of the tool - something in accessories/system menu.

Anyway, I've run ddrescue again from a terminal in /usr/bin using command:
ddrescue -f -n /mnt/sde1 /mnt/sdc1/logfile

Note there is no space before the word logfile. Previous attempts with no '/' and a space did nothing. sde1 and sdc1 are mounted.

The output is the same as before so maybe the 16384b can be rescued. This would seem to be about the same size as the missing page of (plain) text. Dropping the -n produced the same output.

As all other files have now been backed up to DVD, I wonder if deleting all the files would allow ddrescue to concentrate on the problem instead of having to make a copy of everything?

Hopefully you can suggest something. Thanks again.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#12 Post by Sylvander »

1. "I can't even get the package manager to come up"
Enter the command ppm in a terminal, and see if the terminal tells you what's causing the failure to run.

2. "I don't recall seeing the sceenshot you gave with the selection bullets across the top"
You would need to [as I did] configure the PPM, choosing the [maximum of 5] repo's to include in the list at top.
Those are the repo's that are searched when you search for a package [such as ddrescue].
My own search produced that single find of a version of ddrescue.

3. "I looked carefully at the choices available - no ddrescue"
You need to do a search.
In mine, I was asked which repo's I wanted to search, and chose to search all of the repo's [ALL were listed as one particular option].

4. "wife does have some uncomplimentary things to say about my ability to see what's in front of me! "
I have the same problem...
I call it "mind blindness"; the eyes see, but the mind does not comprehend that which is seen.

5. "Any easy fix for that or do I have to re-install puppy from the beginning?"
What I do:
(a) Use a Puppy FRUGAL install.
(b) Make backups of the pupsave at key points along the way, and restore the backup when necessary.
(c) Configure my Puppy so I can choose to NOT SAVE unless there is a good reason to do so.
Hence, nasties are discarded at shutdown/reboot, and the Puppy is as good at next boot as it was at this boot.

6. "I've run ddrescue again from a terminal in /usr/bin using command:
ddrescue -f -n /mnt/sde1 /mnt/sdc1/logfile"
(a) I'm no expert on the use of ddrescue, but I'll do my best to help.
(b) I believe /mnt is wrong;it aught to be /dev
Check whether /dev/sde is listed in your file manager.
This is the source device/DRIVE [not a mounted partition].
I suspect that ddrescue is unable to copy the contents of a drive which has its partition mounted.
I notice that I mention in the example I linked above that the [partition on] the source drive was unmounted.
I expect the destination drive had no partitions, so there was nothing available on that to be mounted.
---------------------------------------------------------------------------------------------------------
The PARTITION on the destination drive/device only appears [AS IF BY MAGIC!] on the Puppy desktop once the drive contents [partitions plus] have been copied [from source to destination].
---------------------------------------------------------------------------------------------------------
[Overwriting anything that was formerly on the drive; in my case nothing]
The fact that your partitions were mounted may be [one of the reasons] why your command fails.
I use Xfe, and my unmounted Flash drive is identified as sdb1, and /dev/sdb1 exists.
(c) /mnt/sdc1/logfile is WRONG!
It aught to be /dev/sdc [a storage device/drive named sdc, with a space between it and the logfile parameter.
What you have incorrectly specified is that the destination is to be a file named "logfile", inside the root folder of a mounted partition named sdc1.
Second reason why the command fails = you are attempting to copy a drive to a file.
Last edited by Sylvander on Fri 02 Nov 2012, 07:34, edited 1 time in total.

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#13 Post by canbyte »

Hi Sylvander
I'll tackle the ppm issue tomorrow but I just tried modifying the terminal command as you suggested and it is certainly doing something different - more in line with expectations. What worked was unmounting the defective drive and mounting the destination drive:

ddrescue -f -n /dev/sde1 /dev/sdc1 logfile
Note the space and lack of / before 'logfile'

Results .
rescued 4004mb, errsize: 0b, errors: 0,
Rox filer found only garbage with no recognizable filenames and lots of gears and orange triangles with exclamation points in them. Not sure where to go with this but it hardly seems possible that the drive is going to be reconstructed.

Cheers
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#14 Post by Sylvander »

1. Oops! :oops:
[Please pardon my previous errors, I've now edited to ammend]
You said:
ddrescue -f -n /dev/sde1 /dev/sdc1 logfile

I think it should be:
ddrescue -f -n /dev/sde /dev/sdc logfile
...If you want to copy [the total contents of] one drive to the other.
The destination drive needs to be at least as big as the source, so it can take ALL of the contents coming from the source.
i.e. Partitioning, formatting, folders, files.

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#15 Post by canbyte »

hi Sylvander
re ppm - the result from your suggestion:
**error**; gtkdialog: Error in line44, near token '</default>': syntax error
aborting...
I tried to find gtkdialog. Pfind found it in /usr/sbin but when I went to look, I found the /usr and /sbin directories but not /usr/sbin. Hmm. I don't really understand puppy filesystem sometimes. How can a whole subdirectory just disappear?

re ddrescue -
Oops not needed! You were right the first time - when I looked in /dev, I found sde1, sde2, sde3 even though sde is not partitioned. sdc goes up to 15, sdd and sde goes up to #8 so it looks like puppy was just anticipating what might be found.

To my surprise and delight, what looked like garbled garbage on the rox filer for the destination drive last night, looks perfectly fine this morning. !! This I discovered when puppy found and used a _save that had been transferred - correctly.

Alas, though, no extra file containing the missing pages/ clusters.

I do notice however, that in a directory called found.000, there are two files - file0000.chk (gear icon, 16k) and file001.chk (text icon, 96k, about the right size for my missing work). I can't open as text although I do recall opening it a few days ago and finding nothing. I now am confused as to whether this was put there by ddrescue or by testdisk (detailed on other thread linked above).

Going back a few posts, you mentioned Xfe. What's Xfe? Would it help to open file0001.chk?

Thanks again.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#16 Post by Sylvander »

1. "I found the /usr and /sbin directories but not /usr/sbin"
I have /bin /sbin /usr/bin /usr/sbin
Both /usr/bin and /usr/sbin are full of program files.
/usr/sbin/gtkdialog is present on my system.

2. "**error**; gtkdialog: Error in line44, near token '</default>': syntax error
aborting..
"
This is beyond my ken.
When I open the gtkdialog file on my system using leafpad, there are no lines of code displayed, so how is there an error in line 44? :?

3. "I do notice however, that in a directory called found.000, there are two files - file0000.chk"
Oh dear!
Did you have the flash drive plugged in when you booted Windows?
Looks like you did, and Windows auto-scanned the contents of the drive during boot, and "repaired" what it [correctly?] thought was errors.
This often produces "lost" file [or folder] fragments that windows auto-names in the form file0000.chk
I know of no way to re-attach these lost fragments.
The problem is often made worse by fragmentation = files not being "contiguous", and some non-contiguous portion of the file being "lost".
I do remember once looking directly at the contents of such a .chk file using a program in windows that looks at the 1's and 0's on the storage medium.

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#17 Post by Sylvander »

Forgot to mention...
(a) If you have some idea of the original file type of the .chk file...
[e.g. .txt or .jpg]
And if it is a complete [contiguous] file [that has been "lost" from the file system]...
You could try renaming with a suitable 3-letter extension...
Hoping that when it is "Opened..." with the appropriate program...
You will then see the content.
You can then give the file a suitable name, and you will have a recovered file. :D

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#18 Post by canbyte »

Hi Sylvander, I got waylaid by some problems lately so haven't been pursuing this but I did try to change the extension. Sadly, no luck.

Here is another strange thing. One files that was recovered seems to have grown- an abiword file (.rtf) was orignally 13k and on the recovery disk is 32k even though the smaller file is actually longer (some was added). Weird. Just an anomaly?

EDIT: Note - When Geany and Abiword will not open a file, try using the browser or it's associated composer window.
Last edited by canbyte on Sat 01 Dec 2012, 04:41, edited 1 time in total.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#19 Post by Sylvander »

1.
canbyte wrote:Here is another strange thing. One files that was recovered seems to have grown- an abiword file (.rtf) was orignally 13k and on the recovery disk is 32k even though the smaller file is actually longer (some was added). Weird. Just an anomaly?
Perhaps ddrescue copies everything in the file...
i.e. Occupied+empty space...
So the copy is larger than the original.
Just guessing!

2. Where ddrescue provides a great service...
Is when the hardware of the source drive is faulty.
e.g. A HDD with faulty clusters.
And you copy to a fault-free storage device, so you're no longer attempting to read from faulty hardware.

(a) But it seems to me that your source Flash Drive hardware isn't faulty...
It's just that the file system on it got corrupted...
[You could (now that you have a good copy) scan&fix its filesystem, using a suitable terminal command, or else Gparted->"check" the partition]
This can cause "lost" fragments or files.
However...
I think Windows has already scanned and fixed and caused "lost" items.
So no harm in now scanning and fixing the source with a Puppy program methinks.
Or else you could make a 2nd copy and play around with the 2nd copy.

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

adding attachment

#20 Post by canbyte »

Been awhile but i found something that may point to the cause of the problem. I was able to see some strange code using a crazy little notebook i got in a garage sale - a CEF 7" with Windows CE. Wordpad was the app. At the beginning of the corrupted part was the word Autorun. Don't know where it came from but at one point was fooling around with some automatic stuff and maybe it jumped into this file. Anyway, if anyone wants to try looking at the file and figuring out what is going on, I'd be interested in any thoughts, suggestions.

Well, i thought I'd upload the file but it seems that I can't do that. Says extension .... not allowed, regardless of whether the file is .txt or .pwd or extension removed. Well, the only way is to take a picture on the little machine - maybe it's safer that way too. I just did the first of about 4 screens. The last is just a screen full of squares.
Attachments
PC070067.JPG
(77.2 KiB) Downloaded 494 times
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

Post Reply