0

So I have a 64GB SanDisk Cruzer Glide, and recently something happened to it. Whenever I would try to fsck it said the magic number for the superblock was corrupted, I didn't know what that meant, so I backed up everything with dd to a 1TB hard drive.

I formatted it as exFAT in macOS, and put it back into my Pi 400. I tried to mount the .img file to a directory I made so I can try to copy the files over to the thumb drive, so I can then copy them to my hard drive, but whenever I try to mount the .img file, I get this...

root@ubuntu:/home/wolfyn_claw# mkdir /mnt/glide2
root@ubuntu:/home/wolfyn_claw# mount -o loop '/media/wolfyn_claw/AC_STORAGE/glide2.img' /mnt/glide2
mount: /mnt/glide2: wrong fs type, bad option, bad superblock on /dev/loop17, missing codepage or helper program, or other error.

I'm attempting to write the .img file back to the thumb drive and see how that goes. I'm really hoping I can access the files on it, I can't afford to lose any of it.

Unable to format on macOS

I attempted to fsck the thumb drive, but whenever I do so it says the magic number in he superblock is invalid.

Bad superblock

Before I did this, I backed up the thumb drive dev/sda1 to an .IMG file with dd. The file is ~63.5GB, and is stored on my hard drive.

Help is really appreciated, I really need to get these files back. Once it works again, I'll transfer everything to my 2TB SSD.

7
  • 2
    Please do not post text as images, but cut-and-paste the text. Jul 8, 2021 at 20:22
  • 1
    This is one reason using dd to back up a data partition is an even worse idea than using it to back up a whole system. Why??!?? cp -a is your friend; then you are not dependent on any particular fs type.
    – goldilocks
    Jul 8, 2021 at 21:10
  • Did you dd the whole thumb drive /dev/sda or only its partition /dev/sda1? What was exactly the command you used?
    – Ingo
    Jul 9, 2021 at 7:47
  • @goldilocks: In fact dd is the best command here. Of course if the filesystem is accessible and not corrupt, you can copy with cp. But if you need to do further forensics to get the files back, you should always work on a copy of the image, not on the image itself. Jul 9, 2021 at 8:25
  • @LjmDullaart I guess I did misread the first paragraph -- if there is really nothing else you can do, fair enough. So all apologies (but I'll leave that comment in case anyone sees this and goes, "hey yeah I guess I could back up my data partition that way" >_<). As Ingo implies, there is a bit of an issue here with the OP "paraphrasing" things that might as well be put literally: "I used dd if=/dev/sda1 of=some.img bs=4M" etc.
    – goldilocks
    Jul 9, 2021 at 14:13

1 Answer 1

3

so I backed up everything with dd to a 1TB hard drive.

That is the best action that you did. When you try anything, do it on a copy of this file, not on this file itself.

First make a copy of the image and work on that copy. If anything goes wrong, you will still have the original image.

The fact that you use fsck on the original image suggests that you have, at one point, formatted it as ext2/3/4. The original superblock is gone, but there may be valid backups. Use

dumpe2fs /dev/sda5 | grep -i superblock

to find them.

You will get lines that say

Backup superblock at 98304, Group descriptors at 98305-98537

So, try to mount it with:

mount -o sb=98304 -o loop '/media/wolfyn_claw/AC_STORAGE/glide2.img' /mnt/glide2

If that superblock does not work, try another one.

----- edit -----

You should have dd-ed the whole disk, probably with

dd if=/dev/sda of=/some/image.img

In that case, you will need to mount the correct partition in the image. You will need to mount it with an offset.

To determine the offset, do

fdisk -l imagefile

Calculate the offset = start sector * size of a sector in bytes and mount with

mount -o ro,loop,offset=<offset you calculated> -t auto imagefile /mnt/mountpoint
6
  • 1
    Good advise but it doesn't help if he doesn't use the correct start sector of the partition. With wrong start sector he will also get the same error message and will not find other superblocks.
    – Ingo
    Jul 9, 2021 at 7:53
  • 1
    "You should have dd-ed the whole disk" -> How would this help? It only complicates. BTW, if the OP is unsure it is simple to check with fdisk -l image.img; if it's the whole device you should get a sane partition table.
    – goldilocks
    Jul 9, 2021 at 14:17
  • I'm using fsck because I thought that was the correct command to fix exFAT filesystems... Guess not.
    – Achak Claw
    Jul 10, 2021 at 3:32
  • I tried to find the offset, but I can't get a good enough result. root@wC-ubmPi400:/media/wolfyn_claw/AC_STORAGE# dumpe2fs /dev/sdc1 | grep -i superblock dumpe2fs 1.45.7 (28-Jan-2021) dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1 Couldn't find valid filesystem superblock. `
    – Achak Claw
    Jul 10, 2021 at 3:33
  • I did the same thing for dev/sdc, and I got: Found a dos partition table in /dev/sdc
    – Achak Claw
    Jul 10, 2021 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.