LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-12-2012, 11:19 AM   #1
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Rep: Reputation: Disabled
Data Recovery, formatted my ext4 as vfat by mistake


I dont want to beg by dev/sdb1 is my life, I just run
Code:
mkfs.vfat -F 32 -n 1GBdrive /dev/sdb1
by mistake, I was meaning dev/sdc1

partition table is untouched, my partition was ext4. It there any way of restoring it as a whole, without using an extra drive. I need that data asap. I'm no expert but guessing from how little time mkfs took to complete, almost all of my data is still there.

I'm thinking about trying "mkfs.ext4 /dev/sdc1" , but not sure if it will wipe my disk even more?

Last edited by Halobok; 02-12-2012 at 04:06 PM.
 
Old 02-12-2012, 12:07 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
http://www.cgsecurity.org/wiki/Data_Recovery_Examples
look at section "Recovery of reformatted partition"
 
1 members found this post helpful.
Old 02-12-2012, 12:12 PM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Halobok View Post
I'm thinking about trying "mkfs.ext4 /dev/sdc1" , but not sure if it will wipe my disk even more?
Do NOT run that. Use testdisk like troop suggests.
 
1 members found this post helpful.
Old 02-12-2012, 12:17 PM   #4
jernejp
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Rep: Reputation: 0
PhotoRec

I would recommend you to give PhotoRec a try:

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

if you have data that you don't want to loose it is a good idea to make a clone of the disk first (Clonezilla is a great tool for that) and then experiment with data recovery on the clone...

Last edited by jernejp; 02-12-2012 at 12:21 PM.
 
Old 02-12-2012, 12:23 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by Halobok View Post
I dont want to beg by dev/sdb1 is my life
No backup for the data that is your life? That is sad, hope you learned the two lessons here:
1. Always have at least one recent backup of your important data.
2. Always double-check system-critical commands before executing them.

Having said that, Photorec (part of the Testdisk package) may save your life, but it depends on which format the files had. If it were images, documents, music or videos than chances are good, if it were a database or some very uncommon formats then you may have lost your data.
 
1 members found this post helpful.
Old 02-12-2012, 12:57 PM   #6
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
Code:
Recovery of reformatted partition

If the partition has been reformatted to another file system (FAT32 formatted as NTFS or vice-versa),

    run TestDisk,
    select the hard disk and the partition type
    choose Advanced
    select the partition
    choose Type,
    enter the value corresponding to the previous filesystem
    choose Boot
    choose RebuildBS
    List
    If you can see your files, choose Write and confirm
    In Analyse, choose to rewrite the partition with the correct partition type.
I cannot find any Boot or RebuiltBS under Advanced??

Also i found this
Code:
 Previous
 superblock 32768, blocksize=4096 [sp]
 superblock 98304, blocksize=4096 [sp]
 superblock 163840, blocksize=4096 [sp]
 superblock 229376, blocksize=4096 [sp]
 superblock 294912, blocksize=4096 [sp]
 superblock 819200, blocksize=4096 [sp]
 superblock 884736, blocksize=4096 [sp]
 superblock 1605632, blocksize=4096 [sp]
 superblock 2654208, blocksize=4096 [sp]

 To repair the filesystem using alternate superblock, run
>fsck.ext4 -p -b superblock -B blocksize device
I ran fsck.ext4 /dev/sdb1 it asked lots of questions about fixing and created too much disk load, so I killed to from damaging files even more.
 
Old 02-12-2012, 01:14 PM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
You can repair the filesystem by running the command that it says. I recommend you do that. If you kill it ... you may kill it completely, if you know what I mean.

EDIT: You know, I just realized that there is no facepalm smiley ...
 
1 members found this post helpful.
Old 02-12-2012, 01:29 PM   #8
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
I cannot undetstand whic command to run

its says fsck.ext4 -p -b superblock -B blocksize device ,
BS is same for all but it shows dozens of superblocks, which one should I use?
 
Old 02-12-2012, 01:39 PM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Well, you can use any of them. I would use one of them in the middle.
 
1 members found this post helpful.
Old 02-12-2012, 03:22 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Before doing anything further, especially dealing with file-system tools, I strongly recommend to make a backup of that partition. The file-system tools can even make more of your data get lost. Use dd or any other partition cloning tool to make a full backup of that partition.
 
1 members found this post helpful.
Old 02-12-2012, 04:06 PM   #11
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
OK my kids childhood photos was there and cd copies was lost.

Logical think was storing a image as many suggested, but i was shit out HDD space for such a dump and I neede some work files asap.

First photorec ripped whatever it could from drive, restoring lots of stuff.

than I ran fsck.ext4 -p -b superblock -B blocksize device , which acted weird and went a little bit crazy. Killed that with ctrl-c


than I said screw it and ran fsck.ext4 /dev/sdb1 , spammed 'Y' for questions. after completition mount failed. I used "-t ext4" to specify type. I ended up with a empty drive. ctrl+h revealed lost+found directory, which had everything I lost in there. I already had sha256 sums for my importent stuff, when I run a check an endless flow of "OK"s starteds. I can hardly even believe that all is back.


H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
H_TeXMeX_H Thank you!!!!!
 
Old 02-13-2012, 02:48 AM   #12
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Ok, but don't kill important commands like that. The command will do what it says. If you kill it, it may mess things up.
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
recovery of formatted data kapil Linux - Newbie 2 09-13-2011 02:09 AM
EXT4 data recovery micemicerabies Linux - General 5 08-26-2010 01:28 PM
Data recovery from a formatted hdd drsa2 Linux - General 2 02-10-2010 02:57 PM
ext3 used as ext4 by mistake.. Any way to recover my data? Please help. DigiH Linux - Desktop 9 11-27-2009 02:27 AM

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

All times are GMT -5. The time now is 11:26 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