0

I'm trying to recover stuff after I accidentally formatted an ext4 partition. I'm running the system from a Live USB, and following this guide to mount a backup superblock. However, I get an error when I'm trying to mount it. Here's what I get:

ubuntu@ubuntu:/$ sudo dumpe2fs /dev/nvme0n1p4 | grep -i superblock
dumpe2fs 1.45.3 (14-Jul-2019)
  Primary superblock at 0, Group descriptors at 1-31
  Backup superblock at 32768, Group descriptors at 32769-32799
  Backup superblock at 98304, Group descriptors at 98305-98335
  Backup superblock at 163840, Group descriptors at 163841-163871
  Backup superblock at 229376, Group descriptors at 229377-229407
  Backup superblock at 294912, Group descriptors at 294913-294943
  Backup superblock at 819200, Group descriptors at 819201-819231
  Backup superblock at 884736, Group descriptors at 884737-884767
  Backup superblock at 1605632, Group descriptors at 1605633-1605663
  Backup superblock at 2654208, Group descriptors at 2654209-2654239
  Backup superblock at 4096000, Group descriptors at 4096001-4096031
  Backup superblock at 7962624, Group descriptors at 7962625-7962655
  Backup superblock at 11239424, Group descriptors at 11239425-11239455
  Backup superblock at 20480000, Group descriptors at 20480001-20480031
  Backup superblock at 23887872, Group descriptors at 23887873-23887903
ubuntu@ubuntu:/$ sudo mount -o sb=32768 /dev/nvme0n1p4 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/nvme0n1p4, missing codepage or helper program, or other error.
ubuntu@ubuntu:/$ sudo mount -o sb=98304 /dev/nvme0n1p4 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/nvme0n1p4, missing codepage or helper program, or other error.
ubuntu@ubuntu:/$ sudo mount -o sb=23887872 /dev/nvme0n1p4 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/nvme0n1p4, missing codepage or helper program, or other error.

What am I doing wrong here?

Meeep
  • 101
  • 3
  • Welcome to the site. Are you sure that this is the right approach to use? As far as I know, backups of superblocks cannot usually be used to recover accidentally deleted data, but are an emergency measure to allow access to a corrupt filesystem. If you want to "undelete" files from an `ext` fileystem, you could try a tool like [`extundelete`](http://extundelete.sourceforge.net/) (but make sure _not to modify the partition where the lost files were located when installing any such utility_). – AdminBee Mar 17 '20 at 12:15
  • Thanks for the reply! My problem is that I installed a new Linux distro and formatted the whole partition (it was a quick format). I backed up all my important stuff, just remembered something that I forgot to back up and it would be nice to recover it. I found someone with a similar problem, and that was the answer: https://unix.stackexchange.com/questions/168704/data-recovery-from-an-accidental-format-on-ext4-partition – Meeep Mar 17 '20 at 12:32
  • I understand. In that case, I would recommend you to edit your question; the current wording will probably lead many readers to think that the issue was an accidentally deleted file. – AdminBee Mar 17 '20 at 12:48
  • Thanks, I edited the question. The link you posted is exactly the same as the one I posted earlier. It contains the instructions that I already tried to follow, and I got an error, that's why I posted this question. – Meeep Mar 17 '20 at 13:08
  • Thanks for the link! But that's the solution that I was following, and I got the error that I described in my question. But it's too late anyway, I managed to mount the backup superblock in another way, and it was already a backup of the filesystem after the format, so there was no way to get the old files. – Meeep Mar 18 '20 at 13:48

1 Answers1

0

The first thing to do is make a "dd" copy of the block device to another device, if possible.

Then, run e2fsck on the device to see if it can recover the filesystem. It will automatically check the backup superblock locations normally.

LustreOne
  • 1,555
  • 5
  • 19