LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2014, 06:27 PM   #1
bitcoinstyle
LQ Newbie
 
Registered: May 2014
Posts: 4

Rep: Reputation: Disabled
i need to unformat a hard drive


I have what i HOPE is an easy to answer question. I have a hard drive that used to have xubuntu. Then i popped in a windows disk not knowing this drive was in there. I full formatted the drive, and went on to install windows. Thankfully, the windows disk was messed up and it only copied over maybe 3 files before it said "i cant read this disk"
Then i realized which hard drive was in the tower. My heart sank.
So bad news: full windows format
Good news: hardly anything got overwritten.

Do i have any hope? Maybe a live distro thats good at this sort of thing?
 
Old 05-19-2014, 07:23 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,671

Rep: Reputation: Disabled
Well, in cases like this it is easiest to restore from backup.
If recovering the hard drive is still desired the first step should be to image the whole drive into a file on a larger drive. After mounting that image one can use adventurous ways without risking with anything. You could try and restore your partition table with testdisk utility. It can give amazing results sometimes. If everything fails photorec utility can be used to recover lost data.
 
1 members found this post helpful.
Old 05-19-2014, 07:27 PM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Look up

testdisk

http://www.cgsecurity.org/wiki/TestDisk

Comes as standard with recovery cds, partition magic springs to mind.

But I usually just run a debian liveDVD, get a rootshell and
Code:
apt-get update && apt-get install testdisk
Or, just use whatever linux is to hand.
Orm install linux to a spare drive
 
1 members found this post helpful.
Old 05-19-2014, 07:31 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
+1.
Quote:
Originally Posted by bitcoinstyle View Post
Good news: hardly anything got overwritten.
s/Good/Not-so-Good/
The format to NTFS will have written over the meta-data for the Linux filesystem. I believe it also writes a backup MFT to the end of the filesystem - so you could (at least) be truncated from both ends - and a full format may over-write the entire space.

Last edited by syg00; 05-19-2014 at 07:32 PM.
 
1 members found this post helpful.
Old 05-20-2014, 12:29 PM   #5
bitcoinstyle
LQ Newbie
 
Registered: May 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thank you for your replies. I looked at testdisk sometime after i paid close to 50 bucks for something that didnt work, but it looked like an application, but this hard drive has no OS to run anything.
I googled something that i think will let me image the drive. Easeus should let me, ill try to make it work when my son goes to sleep unless syg means that the trunkated thing means i cant get to the middle stuff
 
Old 05-20-2014, 01:21 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Yes testdisk is a program, you'll need to run it from a live CD/USB. You will need another hard drive on which to dump whatever is recovered. It's doubtful you'll be able to revert everything in-place, chances are you'll have to use a utility to scan the drive and recover what files it's able, which will have to be stored somewhere else.

So

1) Purchase backup drive that's at least double the size of the drive you're trying to recover
2) Burn and boot a live CD/USB, such as SystemRescueCd
3) Use dd to make a backup image of the drive you're trying to recover into a file on the backup drive, eg:
Code:
dd if=/dev/sda of=/path/to/backup/drive's/mount/location/backup.iso
4) Run testdisk/photorec on this backup image to recover files, which will be placed in the remaining available space on the backup drive
5) When you've recovered everything you can, re-install an OS (any OS) on the drive and copy your files back over from the backup
6) Use your newly acquired backup drive to perform regular backups of the OS so this never happens again
 
1 members found this post helpful.
Old 05-20-2014, 02:33 PM   #7
bitcoinstyle
LQ Newbie
 
Registered: May 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Yes! Systemrescuecd is what i downloaded. So I load a "double the size" hard drive with a nix, and use systemrestorecd to move make an image. Can i use a usb to transfer it? Its a 40 gig hd and i got a usb big enough. If not, i have a hd cable with 2 plugs, ill just have to find out how to hook it up correctly. Then see what i can find using the hard drive that has testdisk on? Sounds complicated, but ill take it one step at a time
 
Old 05-20-2014, 03:06 PM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
No need to load Linux on the new drive, just format it and leave it alone. You don't need an OS on your computer to do this, just burn the systemrescuecd iso to a cd/dvd/usb and boot directly off of that, no installation required, it will just boot into a live Linux distro. Then you can run testdisk, photorec, gparted, dd, or whatever other utilities you need to recover the data from the original drive and dump it on the backup drive. When you're done recovering, then you can install whatever OS you like on the original drive and then restore your backed up files from the backup drive.
 
1 members found this post helpful.
Old 05-20-2014, 03:16 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Keep in mind that while you may be able to recover most/all of your files, they won't necessarily be "usable"...

Depending on the state of the underlying filesystem, you may lose all file names and directory information, and just end up with 40GB of files with random hex names that you'll have to open one-by-one to figure out what they are.

I've only had to do this once before, but luckily it was an SD card that just had images from a digital camera which were in chronological order and had arbitrary names to begin with (DSCN0030, etc), so it wasn't much of a burden.

Last edited by suicidaleggroll; 05-20-2014 at 03:17 PM.
 
1 members found this post helpful.
Old 05-20-2014, 03:57 PM   #10
bitcoinstyle
LQ Newbie
 
Registered: May 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Im marking this as solved if it works or not. The drive might be too far gone. I marked the posts helpful. I hope that gave you rep...
 
Old 05-21-2014, 03:51 PM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Testdisk is worth a try..

Only today I used it to recover a external ntfs drive, which was accidentally formatted ntfs

As has already been pointed out, you may not get 'everything' back
But often you can get what you need.


If you have already 'written off' this data, you have nothing to loose, and experience to gain.

The Ubuntu community forums have a good intro to data recovery

https://help.ubuntu.com/community/DataRecovery

Well worth the read, and I would recomend reading it even if not in 'trouble'
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
format hard drive and add to existing hard drive to extend the capacity in linux boby.kumar Linux - Newbie 1 04-10-2013 07:18 AM
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
[SOLVED] Hardware crash,Repaired,New Install New Hard drive,how to access original Hard drive flatstan Linux - Hardware 7 07-21-2009 06:51 PM
Ubuntu: Installed to external hard drive; boot to primary hard drive gives error 22 dcorb62 Linux - General 7 09-04-2007 11:28 PM
Unformat Hard Drive cekohler1 Linux - General 4 06-21-2007 09:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:38 PM.

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