LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-17-2014, 01:03 PM   #1
jbogaard1
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Rep: Reputation: Disabled
External hard drive failure - doesn't contain a valid partition table


Hi. This is my first post on this forum. I have an external hard drive (Western Digital 1 TB WD10EADS). It failed over the weekend. I connected it to another computer but it doesn't map a drive in Windows. It is detected in Disk Management in Windows and in the BIOS. I would like to try to pull some files off of it if possible. I booted up a machine in Knoppix 7.2. It sees the hard drive but says "Disk /dev/sdb doesn't contain a valid partition table." I've tried mounting the disk but it says moint point /mnt/sdb does not exist.

I'm wondering if anyone has seen this before and can offer some assistance. I would really appreciate any help you could give. Thanks.

Jeff
 
Old 03-17-2014, 02:11 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Is there no partition /dev/sdb1 (or any number)?
If not, the partition table is indeed corrupted.
You could try to write a new partition table with fdisk for Linux - if you dare.
I have done this before, fdisk only changes the partition table and nothing else. All other partition programs I've seen changes a lot more, effectively destroying data.
Of course, I can't guarantee it only tell what I've done.
If the disk only had one partition then simply create a new with fdisk, spanning the whole disk.
Make sure to set the right filesystem.
Then try to mount it.
 
Old 03-17-2014, 02:23 PM   #3
jbogaard1
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks

Thanks for your reply. That makes sense. Excuse my ignorance but what is the command to create a new partition table? I'm just afraid I'll try something wrong and damage the data.
 
Old 03-17-2014, 02:30 PM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
This is the sequence:
Code:
sudo fdisk /dev/sdb
n (create new partition)
p (create a primary partition)
Accept default for first & last cylinder
t (change filesystem id)
Now you'll have to know what filesystem you had. 
w (write changes and exit)
 
Old 03-17-2014, 02:34 PM   #5
jbogaard1
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
OK

You don't think this will overwrite my data? This was an NTFS partition initially.
 
Old 03-17-2014, 02:42 PM   #6
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Well, I've tested this before and no data was overwritten. But it's you that have to take the risk.
Here's one test I did:
A disk with 3 primary partitions, one system (/) partition for some Linux and 2 data partitions. Linux booted fine.
I printed out the partition table, then zeroed out the first 512 bytes of the disk. This left the disk with no partition table, and of course unbootable.
Then I booted a live-cd, used fdisk to recreate the partitions.
Reboot, voila! all 3 partitions were back and the system booted up fine.
The thing is, fdisk does not change any superblock or whatever, it only writes into the partition table residing at the beginning of the disk. Thus no data is touched.
But mind you, this works with primary partitions only, logical volumes are not defined in the partition table.
And again, this is what I would do - but it's your disk, you have to decide. Don't blame me if it doesn't work or you mess it up doing something wrong.
If you can, get some other disk and test with - you're obviously not familiar with fdisk so I would definitely recommend you to test it first!
 
Old 03-17-2014, 02:55 PM   #7
jbogaard1
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Gave it a try

Now it says that the NTFS signature is missing. When I open up PCMan, it shows up but is empty. I tried to manually mount it but got the error message. Grrr.
 
Old 03-17-2014, 03:02 PM   #8
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Got lots of links googling on "NTFS signature", try that.
But again, I strongly suggest you test this first, especially if you're not very familiar with these things. Doing something wrong might destroy your chances to get your data back.
 
Old 03-17-2014, 03:54 PM   #9
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Do NOT write anything to the bad HDD, doing so can overwrite data that you want to recover.

As the partition will not mount and the drive is gonna fail soon, I think your only chance now is to use 'ddrescue' to image the HDD to another larger disk. After doing this you can use testdisk/photorec and foremost to get your data off.

If you can mount the HDD internally then it might be a good idea, to exclude possible failure of the SATA/USB conversion hardware part of the enclosure.

Quote:
Originally Posted by pingu View Post
You could try to write a new partition table with fdisk for Linux - if you dare.
I have done this before, fdisk only changes the partition table and nothing else. All other partition programs I've seen changes a lot more, effectively destroying data.
Please do not recommend this again. It is very likely to destroy data. I'm assuming you made a mistake and mistakenly shared it with others.

Last edited by metaschima; 03-17-2014 at 03:58 PM.
 
Old 03-21-2014, 01:57 PM   #10
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by metaschima View Post
Please do not recommend this again. It is very likely to destroy data. I'm assuming you made a mistake and mistakenly shared it with others.
Nope, it will not destroy data if done right.
I realize it sounds like a bad idea, but I have tested this so many times and it works fine. Read the test I did, I have done that over and over again.
The thing is, fdisk does not alter anything but the partition table. Try it out!
Use an old disk and experiment, you'll see that you can easily recreate all primary partitions without any data loss!
 
Old 03-21-2014, 04:40 PM   #11
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by pingu View Post
Nope, it will not destroy data if done right.
I realize it sounds like a bad idea, but I have tested this so many times and it works fine. Read the test I did, I have done that over and over again.
The thing is, fdisk does not alter anything but the partition table. Try it out!
Use an old disk and experiment, you'll see that you can easily recreate all primary partitions without any data loss!
Why wouldn't you use testdisk instead, which can recover damaged partitions ? You would risk getting something slightly wrong and overwriting your data ?
 
Old 03-21-2014, 05:02 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
As Spock might say, that is logically inconsistent. You are yelling at people to not write to the disk, but recommending testdisk ?. This is the same as fdisk writing (primary) partition entries.

Generally testdisk is the (best) answer, but can be complex for new users. Generally using fdisk is a last resort for those who know what they are doing - however, if you define a partition across the entire device, the first filesystem will usually be mountable. Regardless of size.
Any other filesystem(s) will be safe unless the initial filesystem is enlarged.

Looks like a corrupted disk - maybe unplugged while still writing.
 
Old 03-21-2014, 07:32 PM   #13
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by syg00 View Post
As Spock might say, that is logically inconsistent. You are yelling at people to not write to the disk, but recommending testdisk ?. This is the same as fdisk writing (primary) partition entries.

Generally testdisk is the (best) answer, but can be complex for new users. Generally using fdisk is a last resort for those who know what they are doing - however, if you define a partition across the entire device, the first filesystem will usually be mountable. Regardless of size.
Any other filesystem(s) will be safe unless the initial filesystem is enlarged.

Looks like a corrupted disk - maybe unplugged while still writing.
It's pure logic, I did recommend NOT to write to the disk. The second post, where I ask a question, it is NOT making a recommendation. If you want a purely logical and pedantic statement it would be: If I would decide to write to the disk, then I would use testdisk and not fdisk, except as a last resort. They both write to the disk, but testdisk is designed to recover partitions, whereas fdisk is designed to write and overwrite partitions, among other things. Please let the pedantism end here, it doesn't help anyone, it's just a rather menial method of criticism.

Either way, it didn't work in this case, and luckily it didn't cause any harm.

Also note that I'm NOT saying that fdisk WILL cause damage, or that you are wrong in your personal experience with fdisk. I am saying that using fdisk is wrong here, except as a very last resort, because it can cause damage and it is not designed for this purpose. I also understand that you (pingu) are defending your position, but I ask you to reconsider the issue and whether it is the right program to use. Likely, what I said will have absolutely no effect on anything, but I leave it here for others to read and consider anyway.

In this thread my next response will be only to directly address the OP's next post.

Last edited by metaschima; 03-21-2014 at 07:34 PM.
 
Old 03-21-2014, 08:22 PM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Writing the partition table is writing the partition table, regardless of what tool does it. In the hands of someone not familiar with it, testdisk is by far the more dangerous tool, for several reasons:
  • It can try to "recover" what it might see as logical partitions within a missing extended partition, and doing that can easily overwrite data,
  • testdisk is capable of doing a lot more than just recovering a partition table, and some of those actions should never be taken on your only copy of the data on that disk,
  • testdisk has a fairly awkward and unclear user interface, which can easily lead an unfamiliar user to do the wrong thing.
fdisk is a much safer tool to use. You would have to deliberately alter an extended partition or the logical partitions within to get it to write anywhere other than the last 66 bytes of the MBR.
 
  


Reply



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
[SOLVED] new hard drive doesn't contain a valid partition table bmaguire Linux - Hardware 8 08-06-2012 01:58 PM
Disk doesn't contain a valid partition table? vihag Linux - General 5 01-16-2012 04:46 PM
Disk doesn't contain a valid partition table baldurpet Linux - Newbie 17 05-10-2009 03:25 AM
One partition of external hard drive works, other doesn't rowebil Linux - Hardware 2 03-11-2009 02:23 PM
Disk doesn't contain a valid partition table expatCM Linux - Hardware 9 10-01-2007 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration