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/sdamke2fs 1.47.0 (5-Feb-2023) Found a gpt partition table in /dev/sda Proceed anyway? (y,N)sudo mke2fs -n /dev/sda2mke2fs 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/sda1mke2fs 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?
Proceed anywayor 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.sudo parted -l.