I recently had to use testdisk as well as these steps (Recover ext4 file system after quick format) to recover an accidentally formatted ext4 partition.
After recovering the Ext4 partition from a backup superblock, I can mount it manually and view my lost files. However, the partition still shows up as unknown in the "disks" utility, and I can't mount the drive through Nautilus.
Any ideas how to fix this problem?
EDIT:
What went wrong in the first place is that I accidentally formatted an ext4 partition (named "ExtraDrive1") to Fat32 (named "aaaaa"). The device name corresponding to this partition is /dev/sdb1.
I have tried:
- Opening gdisk and hitting "w" to fix.
This did not work because the metadata of the partition still contains information about the drive "aaaaa". So, it restored the accidentally created fat32 filesystem instead of the lost ext4 drive.
- using the Disks utility and Gparted:
It seems like there is no way to deal with this situation built into these utilities. They only support formatting drives, not repairing the metadata of a drive without formatting.
- Using the "write" option in Testdisk
When I open up testdisk, it initially shows the drive "aaaaa". After performing a quick search, it shows "ExtraDrive1" and it gives me the "Write" option. However, hitting the "write" button and then rebooting doesn't seem to change anything.
Additional info
I can open ExtraDrive1 in testdisk and view the files. I can also manually mount /dev/sdb1 using sudo mount -t ext4 /dev/sdb1 ./temp/
. The problem is that the partition shows up as "Unknown" in the disks utility, and it can't be mounted through nautilus. This seems to suggest that the metadata of /dev/sdb1 still reflects "aaaaa", not "ExtraDrive1".
The output of file -s /dev/sdb1
is:
/dev/sdb1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors/cluster 64, reserved sectors 64, Media descriptor 0xf8, sectors/track 63, heads 255, FAT (32 bit), sectors/FAT 476864, serial number 0x80d4b4c6, label: "aaaaa "