LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-05-2009, 07:31 PM   #1
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Rep: Reputation: 16
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?
 
Old 07-05-2009, 07:52 PM   #2
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,059

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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
 
Old 07-05-2009, 08:10 PM   #3
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by linus72 View Post
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?
 
Old 07-05-2009, 08:16 PM   #4
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,059

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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
 
Old 07-05-2009, 08:27 PM   #5
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 16
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.
 
Old 07-05-2009, 08:30 PM   #6
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,059

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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?
 
Old 07-05-2009, 08:34 PM   #7
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by linus72 View Post
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.
 
Old 07-05-2009, 08:37 PM   #8
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,059

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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
 
Old 07-05-2009, 08:37 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
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'.
 
Old 07-05-2009, 08:41 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Quote:
Originally Posted by WillingToLikeLinux View Post
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).
 
Old 07-05-2009, 08:43 PM   #11
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by unSpawn View Post
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?
 
Old 07-05-2009, 08:54 PM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
'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'.
 
Old 07-05-2009, 08:58 PM   #13
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,059

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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?
 
Old 07-05-2009, 09:06 PM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Quote:
Originally Posted by linus72 View Post
ebonixcs english
Come again?


Quote:
Originally Posted by linus72 View Post
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.
 
Old 07-05-2009, 09:19 PM   #15
WillingToLikeLinux
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 16
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a usb thumb drive or flash drive as a swap partition. stevenjoseph Linux - Hardware 8 01-16-2012 12:09 PM
Only root can automount CD drive and USB thumb drive km4hr Red Hat 3 03-25-2009 12:30 PM
USB thumb drive detected by usb but not by scsi ashlock Linux - Hardware 6 06-02-2005 02:58 PM
USB drive using different partitions (usb key thumb drive) Arodef Linux - Hardware 0 08-04-2004 06:36 PM
USB thumb drive works great, but I still can't get my USB mouse to work. blk96gt Slackware 8 06-22-2004 01:52 AM


All times are GMT -5. The time now is 05:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration