Recovering an ext4 partition
I have an external drive with an ext4 partition
/dev/sda1 I use for my local borg backups.
It is simply plugged in via usb port, and, mounted with an
fstab generated systemd automount entry. I ran a backup yesterday in the evening without any errors, and this morning, I plugged it in, it was not recognized anymore. The drive would show up with lsblk, but no partition under it.
sudo fsck -R -C -V -t ext4 /dev/sda1 and got the following output:
fsck from util-linux 2.39.2 [/usr/bin/fsck.ext4 (1) -- /dev/sda1] fsck.ext4 -C0 /dev/sda1 e2fsck 1.47.0 (5-Feb-2023) fsck.ext4: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda1 Could this be a zero-length partition? /dev/sda1: status 8, rss 3232, real 0.002321, user 0.001784, sys 0.000000
I have no idea how to interpret that. I only can see the exit code status 8 the man page describes as an ‘operational error’.
sudo parted /dev/sda print
Error: Invalid partition table on /dev/sda -- wrong signature 0. Ignore/Cancel? I Model: SABRENT (scsi) Disk /dev/sda: 1000GB Sector size (logical/physical): 512B/4096B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 8225kB 1000GB 1000GB extended lba
sudo dmesg right after plugging the drive in
[16265.871467] usb 2-6.4: new SuperSpeed USB device number 15 using xhci_hcd [16265.889474] usb 2-6.4: New USB device found, idVendor=152d, idProduct=1561, bcdDevice= 2.04 [16265.889486] usb 2-6.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [16265.889491] usb 2-6.4: Product: SABRENT [16265.889495] usb 2-6.4: Manufacturer: SABRENT [16265.889499] usb 2-6.4: SerialNumber: DB9876543214E [16265.899660] scsi host4: uas [16265.900160] scsi 4:0:0:0: Direct-Access SABRENT 0204 PQ: 0 ANSI: 6 [16268.706521] sd 4:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB) [16268.706530] sd 4:0:0:0: [sda] 4096-byte physical blocks [16268.706759] sd 4:0:0:0: [sda] Write Protect is off [16268.706768] sd 4:0:0:0: [sda] Mode Sense: 53 00 00 08 [16268.707113] sd 4:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [16268.707265] sd 4:0:0:0: [sda] Preferred minimum I/O size 4096 bytes [16268.707270] sd 4:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes) [16268.724287] sda: sda1 < > [16268.724396] sd 4:0:0:0: [sda] Attached SCSI disk [16296.811964] usb 2-6.3: reset SuperSpeed USB device number 14 using xhci_hcd [16340.865861] sda: sda1 < >
Following telecoM advice, I ran
sudo losetup --sector-size 4096 -P -f /dev/sdx. I have a loop1p1 device/partition now.
❯ sudo parted /dev/loop1p1 print Error: /dev/loop1p1: unrecognised disk label Model: Unknown (unknown) Disk /dev/loop1p1: 4096B Sector size (logical/physical): 4096B/4096B Partition Table: unknown Disk Flags: ❯ sudo fsck.ext4 -f /dev/loop1p1 e2fsck 1.47.0 (5-Feb-2023) ext2fs_open2: Bad magic number in super-block fsck.ext4: Superblock invalid, trying backup blocks... fsck.ext4: Bad magic number in super-block while trying to open /dev/loop1p1 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>
Should I give up on trying to recover this partition ? (I have redundant backups, it is not a catastrophe for me, I just want to learn in anticipation for the day it might be one).
Thanks in advance for your help.
My first assumption would be a faulty case, particularly as you’ve got pluggable USB involved. Check that it’s plugged in properly (both ends of the cable) and there’s sufficient power.
I would also check the partition table, which you added to your question. Unfortunately it too shows a faulty read from the device, which is why I suspect the hardware.
Sadly, there are lots of "it doesn’t work" posts with the particular vendor id (
0x152d) and the product id (
0x1561) that you showed. As an example I searched Google for "linux sabrent 152d 1561 usb". You might be better with a different case (I’ve found no issues with my RSHTECH 3.5in SATA case, but as they’re all built to low budgets my experience suggests it’s often a matter of potluck.)