0

I had an ext2 partition and by mistake I reformatted it to ext4.
I immediately noticed the problem because at the next reboot my system wouldn't mount the reformatted partition, which got a new UUID and therefore did not match the one in /etc/fstab.

After reformatting I did not write anything to the disk.
Is there any chance I can recover the data files on this partition?

Pabi
  • 7,401
  • 3
  • 40
  • 49
Giorgio
  • 396

1 Answers1

1

Maybe. I have never tried the following steps, but there are several links to data recovery in AskUbuntu:

Partitions disappeared after power loss while installing

http://www.geekyprojects.com/storage/how-to-recover-data-even-when-hard-drive-is-damaged/

How to recover deleted files?

Charles Green
  • 21,339
  • The problem is that I did a reformat, I am afraid all the filesystem information is lost and there is no way to reconstruct where all the files are, even though the data may still be there. I am not 100 % sure though. – Giorgio Jul 21 '14 at 19:13
  • @Giorgio I understand - the tools in the links may be able to recover some data, although I would read through the posts carefully prior to using any of them. – Charles Green Jul 21 '14 at 19:21
  • @Giorgio take it as a learning task, any positive outcome is a bonus. In the process you will find ways to do things to get it back NEXT TIME you make a mistake, OR learn what to AVOID. Been there doing similar stuff myself. Good luck! – Hannu Jul 21 '14 at 19:56
  • @Hannu: I am the paranoid kind of person, especially when working on partitions, but sometimes your mind just goes on its own: after checking twice that /dev/sdb1 was empty, I umounted it, thought sudo /sbin/mkfs.ext4 /dev/sdb1 and typed sudo /sbin/mkfs.ext4 /dev/sdc1. – Giorgio Jul 21 '14 at 21:04
  • If the ext4 format overwrites all the ext2 filesystem information, then I have no chance. I could recover some isolate files but I won't be able to reconstruct the disk's content. So, is there a chance that ext4 and ext2 write filesystem information on different blocks? – Giorgio Jul 21 '14 at 21:41
  • I can recover individual files with foremost but this is pretty useless if I cannot recover the directory structure. – Giorgio Jul 21 '14 at 21:57
  • https://help.ubuntu.com/community/DataRecovery, http://askubuntu.com/questions/240372/how-to-recover-data-from-ext4-partitions, http://askubuntu.com/questions/41601/is-there-any-recovery-software-available-for-ext4 - seems to be worth reading. – Hannu Jul 22 '14 at 19:00
  • I ended up recovering files with foremost and comparing them to my latest backup using a Python script I have written myself. It seems I did not loose any data: all recovered files were also in the backup. – Giorgio Dec 18 '14 at 10:56