[SOLVED] Data Recovery, formatted my ext4 as vfat by mistake
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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...
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.
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??
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 ...
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.