# Died a hard disk.



## valsorym (Nov 6, 2011)

Hi all, I have a little problem!
I have a HDD (SATA / Western Digital, size: 1Tb). It is connected via USB using a "pocket".
* pocket (sorry for my English) - it is special device which allows connect SATA HDD, use USB interface. That is, what I wonted to say!

Foolishly I formatted the HDD in the ext2 filesystem. (I was recently in the UNIX, and did not know what it threatens. Although today I am already familiar with file systems: ext2, ext3, ext4, ReiserFS, XFS UFS and FAT, NTFS of course).

But there is as it is!
Now my device is defined as: /dev/da0 (I do not have /dev/da0s1 as before).

IMPORTANT! The HDD has the right information.
I have laptop (I do not have PC), but my laptop has eSATA connector (only need to configure it and buy an adapter). Therefore the best option to use USB.

- How can I get this device? 
- Is it possible to do this with FreeBSD? (Or I should  ask for Linux forums?).

* We all do stupid things and even though I do them more often - I'm fixed!


----------



## wblock@ (Nov 6, 2011)

You newfs(8)ed da0 instead of da0s1?  (Or probably mkfs for Linux.)  That overwrote the partition table.  If it was GPT, there's a backup at the end of the disk which gpart(8) can recover.  But don't try that yet!

Do not mount or write to the drive with the damaged filesystem.  Use dd(1) to copy the entire drive to another drive that's at least as large, or a really big file on another drive with enough space.

Disconnect the drive with the damaged filesystem and put it somewhere safe.  Experiment with data recovery tools only on the backup just created.  Use mdconfig(8) to use a file as a device.  When/if the data is recovered, the drive can be reused.


----------



## valsorym (Nov 6, 2011)

Thanks.


----------



## idle (Nov 7, 2011)

Possible.
Check sysutils/testdisk.
http://www.cgsecurity.org/wiki/TestDisk


----------



## valsorym (Nov 7, 2011)

Description of the program looks promising! Thank you!


----------



## tingo (Nov 7, 2011)

If testdisk doesn't work out for you, try sysutils/dd_rescue.


----------



## valsorym (Nov 8, 2011)

Okay, thanks.


----------



## valsorym (Nov 18, 2011)

Use sysutils/testdisk did not work. The program does not find my USB-HDD (/dev/da0). Finds only the HDD (/dev/ada0).
Then I decided to use the dd.
`dd if=/dev/da0 of=/myfolder/rec.img`
- But got a message that not read /dev/da0 does not work.

* Before another appeared the slice /dev/da0s1 (but now it does not appear).

Now I think to do the following.
- Kill start-sector. probably as follows:
`dd if=/dev/zero of=/dev/da0 bs=512k count=1`
- Format it to ext2 again.
- And then restore the files, example  using sysutils/dd_rescue.

But do not spoil if I file formatting?
I hope the formatting in FreeBSD only removes the _inode_.

*** To be continued. ***


----------



## wblock@ (Nov 18, 2011)

dd_rescue probably won't help, something that understands filesystems is needed.


----------



## valsorym (Nov 18, 2011)

Okay, thank you. 
Okay, I think I could live if I lose this data (there only two years of scientific activity).
I will take tough action. 
Thank you for your comment!


----------



## tingo (Nov 18, 2011)

FWIW, I have used dd_rescue on several occasions, and it has helped me. What I have done is the following:
1) use dd_rescue to copy the slices from a dying hard drive to a file (I had much better success with slices than with BSD partitions. YMMV)
2) use mdconfig and mount to mount the files created with dd_rescue as md devices
3) copy data

Repeat as necessary.
Another hint: some dying hard drives work fine when cold, but starts erroring out after they get warm. Use several sessions with dd_rescue, separated by long cool down periods (a couple of hours).


----------

