LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to use TestDisk for recovering my USB thumb drive (http://www.linuxquestions.org/questions/linux-software-2/how-to-use-testdisk-for-recovering-my-usb-thumb-drive-737923/)

WillingToLikeLinux 07-05-2009 08:31 PM

How to use TestDisk for recovering my USB thumb drive
 
This is related to

http://www.linuxquestions.org/questi...g-work-737816/
http://www.linuxquestions.org/questi...-drive-737805/

I have a USB thumb drive that has errors related to permission issues and it became read-only default without any reasons.

Then I found out there is a program called TestDisk: http://www.cgsecurity.org/wiki/Main_Page

When I used TestDisk (without understanding the manual because it's too complicated for beginners), I have a warning error like:

Code:

Warning: Incorrect number of heads/cylinder 128 (FAT) != 124 (HD)
Warning: Incorrect number of sectors per track 63 (FAT) != 62 (HD)
  FAT32                    0  18 29  1018  83 22    7830408 [KINGSTON]
Warning: Incorrect number of heads/cylinder 128 (FAT) != 124 (HD)
Warning: Incorrect number of sectors per track 63 (FAT) != 62 (HD)
  FAT32                    0  18 35  1018  83 28    7830408 [KINGSTON]

And I got an overall result like:

Code:

The harddisk (4009 MB / 3824 MiB) seems too small! (< 4009 MB / 3824 MiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

I don't know where to start. How do I recover my thumb drive?

linus72 07-05-2009 08:52 PM

OK, having read your other 2 posts it seems you have some issues with that usb
now, your using 9.04 right
did you change the permissions settings in the menu top panel "system/administration/permissions"
or authorizations it might be called

ok, also can you post your /etc/fstab?

and fdisk -l

open a terminal in linux and become root with "sudo su"
then, with usb plugged in/mounted do "fdisk -l"
and posty that here

also, as root above, try coping a file(any text file) from ubuntu hd/desktop to usb
with
"cp -a /home/username/Desktop/filename /mount/point/of/usb"

type in "mount" while usb is mounted to find out it's mountpoint
most likely /media/disk or similar
for me, if copying a file to usb from desktop in Ubuntu would be
"cp -a /home/bz/Desktop/myfile.txt /media/disk"

IF you are able to copy a file there then you need to change your permissions
if there is a problem copying then maybe the usb is corrupted format or something

DID you format the usb or is it factory formatted?
if you formatted, how?

as for using testdisk/p0hotorec I am also checking ti out
did you read any info?
( http://www.cgsecurity.org/wiki/TestDisk )

the best way to do it maybe to use partedmagic, which has clonezilla to clone the usb image to somewhere where you can safely hack at it with testdisk etc and preserve the original so when you get it down on how to fix it you run the real one.

theres also dd rescue too
which should provide info thru terminal with "dd rescue -info" or "info dd rescue"
it's probably available in synaptic pkg manager

WillingToLikeLinux 07-05-2009 09:10 PM

Quote:

Originally Posted by linus72 (Post 3597826)
and fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000dde2d

Device Boot Start End Blocks Id System
/dev/sda1 * 1 60060 482431918+ 83 Linux
/dev/sda2 60061 60801 5952082+ 5 Extended
/dev/sda5 60061 60801 5952051 82 Linux swap / Solaris

Disk /dev/sdb: 4009 MB, 4009754624 bytes
51 heads, 51 sectors/track, 3010 cylinders
Units = cylinders of 2601 * 512 = 1331712 bytes
Disk identifier: 0x04030201

Device Boot Start End Blocks Id System
/dev/sdb1 1 3011 3915204 b W95 FAT32

Quote:

also, as root above, try coping a file(any text file) from ubuntu hd/desktop to usb
with
"cp -a /home/username/Desktop/filename /mount/point/of/usb"

IF you are able to copy a file there then you need to change your permissions
if there is a problem copying then maybe the usb is corrupted format or something
cp: failed to preserve ownership for 'filename.txt': Operation not permitted

Quote:

DID you format the usb or is it factory formatted?
Factory formatted. Never touched my thumb drive in a serious way.

Quote:

the best way to do it maybe to use partedmagic, which has clonezilla to clone the usb image to somewhere where you can safely hack at it with testdisk etc and preserve the original so when you get it down on how to fix it you run the real one.

theres also dd rescue too
which should provide info thru terminal with "dd rescue -info" or "info dd rescue"
it's probably available in synaptic pkg manager
If somebody could write very easy instructions for partedmagic, clonezilla, ddrescue, TestDisk for beginners, it would be very good.

What I find very awkward about ddrescue is that there are tons of instructions about ddrescue for recovering hard disk drives, but never about recovering thumb drives that makes beginner Linux users very crazy. As the way how instructions are worded out for almost all of the data recovery softwares, it is too limited for average people to understand. Too abstract, not enough background information.

I'm sorry that I talk like a self-designated idiot, but what can I say?

linus72 07-05-2009 09:16 PM

I know dude, too much linux docs are f***in for astronauts
it's like chinese to a german, dude.

anyway, what about permissions in menu admin
I think you just have a permissions problem, maybe
and also corrupted data maybe

as root try chowning that bitch
" sudo chown -R username /mount/point/of/usb"

NOTE< NEVER do "sudo chown -R username / "
I did that other day by accident and had to do complete re-install of ubuntu

so, for me, to chown usb would be
as root
"chown -R bz /media/disk"
then I have read/write to usb

WillingToLikeLinux 07-05-2009 09:27 PM

Still not working from chown. It is most likely that it is a corruption of the filesystem FAT32 in my thumb drive.

When I copied a file from my dubious thumb drive to my computer, it shows: Input/output error

Yeah, I think the filesystem is the problem.

linus72 07-05-2009 09:30 PM

OK, check this stuff out

( http://ubuntuforums.org/archive/index.php/t-417761.html )
( http://sysadminhell.blogspot.com/200...-testdisk.html )
( http://ubuntuforums.org/archive/index.php/t-925680.html )

hope that helps some...

Can you explain/remember exactly how/when the problem started?

WillingToLikeLinux 07-05-2009 09:34 PM

Quote:

Originally Posted by linus72 (Post 3597862)
Can you explain/remember exactly how/when the problem started?

It was normal 2 days ago. I just used it without any harsh pressures and suddenly this happened.

For some reason, perhaps the file system got corrupted out of blue. Now it makes me want to ditch FAT for my thumb drive.

linus72 07-05-2009 09:37 PM

Yea dude I run like 8 distro's off my ext3 usb using grub
ext3 is very good for data
it's really easy to setup too
Unspawn may be able to help too
he knows more than me

unSpawn 07-05-2009 09:37 PM

Just use dd_rescue like this (replace "sdb" with the device name for the stick and /tmp with a partition with enough space on it): 'dd_rescue -l /tmp/stick.log -o /tmp/stick.badblocks -A -f -v /dev/sdb /tmp/stick.dd 2>&1 | tee /tmp/stick.tee'.

unSpawn 07-05-2009 09:41 PM

Quote:

Originally Posted by WillingToLikeLinux (Post 3597867)
For some reason, perhaps the file system got corrupted out of blue. Now it makes me want to ditch FAT for my thumb drive.

In this and your other threads you've made some allegations. Now I understand that's probably due to lack of knowledge in the first place and frustration and impatience to get things fixed but I really think you shouldn't as it only serves to distract from what you need to do. Right now the first thing to do is get that backup (just to be safe in case the stick is dying) and then run a "dry run" recovery (to see what you may expect).

WillingToLikeLinux 07-05-2009 09:43 PM

Quote:

Originally Posted by unSpawn (Post 3597870)
Just use dd_rescue like this (replace "sdb" with the device name for the stick and /tmp with a partition with enough space on it): 'dd_rescue -l /tmp/stick.log -o /tmp/stick.badblocks -A -f -v /dev/sdb /tmp/stick.dd 2>&1 | tee /tmp/stick.tee'.

Can you parse (explain) the whole syntax and the meaning of this command line?

Or is there another "step-by-step" way to use dd_rescue, in the context of saving a thumb drive?

unSpawn 07-05-2009 09:54 PM

'dd_rescue -l /tmp/stick.log -o /tmp/stick.badblocks -A -f -v /dev/sdb /tmp/stick.dd 2>&1 | tee /tmp/stick.tee'.
name-of-application -l path-and-name-of-log-file-to-write-to -o path-and-name-of-log-file-that-logs-bad-blocks (do not skip writing blocks) (run less checks) (be verbose) path-to-devicename path-and-filename-of-backup pipe error output to standard output | (pipe standard output to) name-of-application path-and-name-of-log-file. The meaning is to get the backup while logging as much as possible to help troubleshooting later on if necessary. You also could have found this yourself if you opened up a console and typed 'dd_rescue --help'.

linus72 07-05-2009 09:58 PM

Correct me if wrong Unspawn, but in ebonixcs english that is like say you had a partition on your hard drive
say hda1 and usb is sdb
it would be
'dd_rescue -l /hda1/stick.log -o /hda1/stick.badblocks -A -f -v /dev/sdb /hda1/stick.dd 2>&1 | tee /hda1/stick.tee'.

is that right?

unSpawn 07-05-2009 10:06 PM

Quote:

Originally Posted by linus72 (Post 3597885)
ebonixcs english

Come again?


Quote:

Originally Posted by linus72 (Post 3597885)
that is like say you had a partition on your hard drive say hda1 and usb is sdb it would be 'dd_rescue -l /hda1/stick.log -o /hda1/stick.badblocks -A -f -v /dev/sdb /hda1/stick.dd 2>&1 | tee /hda1/stick.tee'.

Sure, if you have a valid mount point /hda1 and you mounted a writable partition there that is OK. The problem with using mount naming schemes that include devicenames is that people might interprete it wrong (ah, he prolly means /dev/hda1) and then write their backup data into the partition instead of to a file on the mounted partition.

WillingToLikeLinux 07-05-2009 10:19 PM

Well. I was sort of expected to understand dd_rescue -l /tmp/stick.log -o /tmp/stick.badblocks -A -f -v /dev/sdb /tmp/stick.dd 2>&1 | tee /tmp/stick.tee like:

1. dd_rescue: It's a way to copy and paste corrupted drives
2. -l: It's about logfiles in respect to the dd_rescue command
3. /tmp/stick.log: destination to action of dd_rescue
...
x. /tmp/stick.tee: ????


You know, one of the popular ways to explain and translate Classical Chinese at a glance in a form of basic sequential logic formula. Easier for both beginners and experts to understand what is going on.

Maybe my ways of understanding things how work is very different from most others. So forgive my stupidity and shortsighted-ness. I will take a temporary break.


All times are GMT -5. The time now is 05:56 PM.