1

I have an external HDD drive formatted as Ext4 connected to my Raspberry Pi server. The server has been crashing lately and as a consequence the HDD is corrupt. When I plug to my computer and run sudo fsck /dev/sda I get the output

fsck from util-linux 2.40.2
e2fsck 1.47.0 (5-Feb-2023)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

Found a gpt partition table in /dev/sda

I searched online and found this answer explaining how to find backup superblocks. However, when I run mke2fs I am not getting a straightforward output as I was expecting, neither on the device (sda) nor on the partitions (sda1 or sda2), and I don't want to proceed if I don't know what I'm doing. I'm afraid I will break something.

These are the outputs:

  • sudo mke2fs -n /dev/sda
    mke2fs 1.47.0 (5-Feb-2023)
    Found a gpt partition table in /dev/sda
    Proceed anyway? (y,N)
    
  • sudo mke2fs -n /dev/sda2
    mke2fs 1.47.0 (5-Feb-2023)
    /dev/sda2 contains a ext4 file system labelled 'data'
        last mounted on /srv/dev-disk-by-uuid-19f0b495-7b9d-4f67-ae8e-9f8933ff19eb on Sat Nov  2 13:36:52 2024
    Proceed anyway? (y,N)
    
  • sudo mke2fs -n /dev/sda1
    mke2fs 1.47.0 (5-Feb-2023)
    /dev/sda1 alignment is offset by 3072 bytes.
    This may result in very poor performance, (re)-partitioning suggested.
    /dev/sda1 contains a vfat file system labelled 'EFI'
    Proceed anyway? (y,N)
    

This makes clear to me that the problem is on partition sda1, but I'm still not confident to proceed with mke2fs. The way it asks Proceed anyway? makes me worry I will break something.

Moreover, I don't know why the hard drive has 2 partitions nor what the EFI partition sda1 is (this is not a system drive, just an external data drive, although it has docker containers installed in it).

Is mke2fs -n the right command for me here? If so, should I run it on sda or sda1? Should I repeat what I did and select Proceed anyway?

6
  • unix.stackexchange.com/a/785007/342980 Commented Nov 2, 2024 at 13:42
  • If this data is important, then do you have functional backups? Commented Nov 2, 2024 at 14:50
  • Yes, I have backups. This drive has mostly media that I have backed up on separate drives. Regarding docker, I have the yaml compose files to build the containers again. I would, however, like to know if it is safe to choose Proceed anyway or if it is risky and there is a better option. Although I have backups, I would rather not mess that hard drive and have to set up everything again. Commented Nov 2, 2024 at 15:00
  • 1
    A drive like sda, does not normally have a format. Or you run fsck on the ext4 partition like /dev/sda2. If sda1 is the ESP - efi system partition then it is FAT32 and you have to run dosfsck. Know your partitions and formats with sudo parted -l. Commented Nov 3, 2024 at 16:20
  • 1
    Did you try running e2fsck on /dev/sda2? It looks like it contains the "data" ext4 filesystem, while /dev/sda is the whole disk device. You definitely do not want to run mke2fs on /dev/sda in this case. Commented Nov 3, 2024 at 18:05

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.