Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-18-2005, 01:24 AM   #1
LQ Newbie
Registered: Aug 2005
Location: Norfolk, VA
Posts: 7

Rep: Reputation: 0
Harddrive Recovery

Okay well I screwed up and while installing another distro and formatted the wrong partition. This is a critical partition I need to recover this if it is at all possible. Does anyone know anyway to do this?
Old 09-18-2005, 01:45 AM   #2
LQ Guru
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
I am sorry, but you are screwd if the installer wrote files to it. Backups are golden when you are at this period of time.
Old 09-18-2005, 02:27 AM   #3
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,327

Rep: Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965
If you formatted with the exact same size partition, and didn't write all kinds of files over it, you can recover. Just run fsck. There are different flavors of fsck. There is fsck.reiserfs, fsck.ext3, and so on. You want to do a "fsck.filesystem --rebuild-tree /dev/sda3", or whatever partition it is. You can run this from a boot cd, and I would recommend it, especially if it is the root partition.

for boot cd with many tools

For someone who isn't sure if this will work, it takes what seems like an eternity. You will probably have many files in "lost+found" directory. You can look through these and see where they go. Since all the files you really need can be identified by looking inside of them, you can just do a "cat filename | less". If the file looks like something you want, keep it. If you can't decide, just leave it there. If you know you don't need it, get rid of it.

I wouldn't be too hasty. Just take your time, and keep your wits about you. File systems are recoverable if you haven't written to them, or repartitioned. You just have to unscramble "lost+found".

I have every confidence you will back up from now on. I put two identical HDD's in each computer. Then, before I'm going to screw with anything major, I do:

dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror

to create an exact image of sda on sdb. You do this from a boot disk, too. Make sure the if= is the intended source, and of= is the intended target. Then, if you mess up you can do:

dd if=/dev/sdb of=/dev/sda bs=4096 conv=notrunc,noerror

And write the good copy back to the messed up one and mess it up again, maybe. This way you have no fear, and you can really learn by taking huge risks. No matter what happens, you can just write the good image to your boot drive, and start over.

If you want to see what your system ram actually has in it:

dd if=/dev/mem of=/home/sam/memimage bs=1024


view the file memimage

See my post on learning the dd command.
Old 09-18-2005, 03:08 AM   #4
LQ Newbie
Registered: Aug 2005
Location: Norfolk, VA
Posts: 7

Original Poster
Rep: Reputation: 0
Okay when I re-formatted I did change the filesystem type from ext2 to reiserfs will this still work?


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
backup whole harddrive for disaster recovery ngocd Linux - Software 1 06-03-2005 04:29 PM
Recovery TheOracle Linux - Newbie 4 05-14-2005 02:05 PM
recovery ilnli General 1 02-23-2005 01:10 AM
Installing linux on 2nd harddrive(dual boot) windows on seperate harddrive lysol Linux - Software 25 08-03-2004 09:33 AM
Need to replace full harddrive with new, larger harddrive pearlr Linux - Newbie 1 01-02-2004 12:59 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:54 AM.

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