OBS broke my Ubuntu installation, had to move to Fedora 40: How do I recover data from HDD?

I installed OBS Flatpak Yesterday on my Ubuntu 24.04 LTS, I tried to record my Screen but it could not happen - the sources list didn’t have the Display Screen Recording or Screen Source (I forgot correct Source name).

So, I did a update, upgrade, flatpak update for any package missing for OBS - the apt update didn’t go through, so I did a restart of Ubuntu

After Restart - Black Screen Right Side Top showing “checking media_” my HDD didn’t shown up - went to BIOS Settings it didn’t shown up - EFI and EFI PXE NETWORK were present - EFI is in Grey not able select as BOOT - tried with Secure Boot Enabled, didn’t go through

Before installing OBS did a Stress test on my HDD to get Read & Write Speeds using fio package - it worked fine after the test

Bought BX 500 SDD installed Fedora 40

I need to Recover my Data from HDD

So, when I tried to mount my Ubuntu HDD - I am not able to do it

created a HDD folder in /mnt dir

sudo mount /dev/sdb /mnt/hdd/

mount: /mnt/hdd: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
sudo fsck /dev/sdb 
fsck from util-linux 2.40.1
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/sdb

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>

How can I go ahead

First, we don’t mount a whole drive, but a partition on it.
What does
lsblk
output?

2 Likes

Second, I’m afraid this disk just died.
I’d like to see the output of smartctl as follows:
sudo smartctl -a /dev/sdb

Assuming sdb is the disk in question.

You may need to install smartmontools package to have smartctl:
sudo apt install smartmontools

2 Likes

Hi

Please check output using smartctl

Let me know how can I get my data back

sudo smartctl -a /dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.11-200.fc40.x86_64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Mobile HDD
Device Model:     ST1000LM035-172
Serial Number:    WES0
LU WWN Device Id: 5 000c50 09c
Firmware Version: LCM2
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sun Sep 29 19:23:05 2024 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(    0) seconds.
Offline data collection
capabilities: 			 (0x71) SMART execute Offline immediate.
					No Auto Offline data collection support.
					Suspend Offline collection upon new
					command.
					No Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   1) minutes.
Extended self-test routine
recommended polling time: 	 ( 167) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x3035)	SCT Status supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   075   055   034    Pre-fail  Always       -       159118227
  3 Spin_Up_Time            0x0003   099   099   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   037   037   020    Old_age   Always       -       65535
  5 Reallocated_Sector_Ct   0x0033   090   090   036    Pre-fail  Always       -       6233
  7 Seek_Error_Rate         0x000f   081   060   045    Pre-fail  Always       -       138080067
  9 Power_On_Hours          0x0032   078   078   000    Old_age   Always       -       19543 (160 179 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   090   090   020    Old_age   Always       -       11068
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   001   001   000    Old_age   Always       -       3097
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       25770197005
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   067   044   040    Old_age   Always       -       33 (Min/Max 32/33)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       262
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       458
193 Load_Cycle_Count        0x0032   001   001   000    Old_age   Always       -       251115
194 Temperature_Celsius     0x0022   033   056   000    Old_age   Always       -       33 (0 19 0 0 0)
196 Reallocated_Event_Count 0x0032   090   090   000    Old_age   Always       -       6233
197 Current_Pending_Sector  0x0012   099   096   000    Old_age   Always       -       96
198 Offline_Uncorrectable   0x0010   099   096   000    Old_age   Offline      -       96
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       4
240 Head_Flying_Hours       0x000f   079   079   030    Pre-fail  Always       -       18986 (123 163 0)
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 2757 (device log contains only the most recent five errors)
	CR = Command Register [HEX]
	FR = Features Register [HEX]
	SC = Sector Count Register [HEX]
	SN = Sector Number Register [HEX]
	CL = Cylinder Low Register [HEX]
	CH = Cylinder High Register [HEX]
	DH = Device/Head Register [HEX]
	DC = Device Command Register [HEX]
	ER = Error register [HEX]
	ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 2757 occurred at disk power-on lifetime: 18307 hours (762 days + 19 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: WP at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  61 00 00 ff ff ff 4f 00      00:18:51.111  WRITE FPDMA QUEUED
  61 00 00 ff ff ff 4f 00      00:18:51.007  WRITE FPDMA QUEUED
  60 00 08 ff ff ff 4f 00      00:18:50.504  READ FPDMA QUEUED
  61 00 c0 ff ff ff 4f 00      00:18:47.275  WRITE FPDMA QUEUED
  61 00 00 ff ff ff 4f 00      00:18:47.274  WRITE FPDMA QUEUED

Error 2756 occurred at disk power-on lifetime: 18307 hours (762 days + 19 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 08 ff ff ff 4f 00      00:18:41.132  READ FPDMA QUEUED
  61 00 00 ff ff ff 4f 00      00:18:41.104  WRITE FPDMA QUEUED
  61 00 08 08 7c 0b 45 00      00:18:41.104  WRITE FPDMA QUEUED
  60 00 08 ff ff ff 4f 00      00:18:41.078  READ FPDMA QUEUED
  60 00 08 ff ff ff 4f 00      00:18:41.042  READ FPDMA QUEUED

Error 2755 occurred at disk power-on lifetime: 18307 hours (762 days + 19 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      00:18:04.947  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:18:04.804  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:18:04.802  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:18:04.779  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:18:04.757  READ FPDMA QUEUED

Error 2754 occurred at disk power-on lifetime: 5619 hours (234 days + 3 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 cf a5 e3 09  Error: UNC at LBA = 0x09e3a5cf = 165914063

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 01 cf a5 e3 49 00      02:04:34.004  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      02:04:33.992  READ LOG EXT
  60 00 01 ce a5 e3 49 00      02:04:33.863  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      02:04:33.861  READ LOG EXT
  61 00 08 00 da 12 40 00      02:04:33.816  WRITE FPDMA QUEUED

Error 2753 occurred at disk power-on lifetime: 5619 hours (234 days + 3 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ce a5 e3 09  Error: UNC at LBA = 0x09e3a5ce = 165914062

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 01 ce a5 e3 49 00      02:04:33.863  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      02:04:33.861  READ LOG EXT
  61 00 08 00 da 12 40 00      02:04:33.816  WRITE FPDMA QUEUED
  60 00 01 cd a5 e3 49 00      02:04:33.754  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      02:04:33.739  READ LOG EXT

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Conveyance offline  Completed without error       00%      7311         -
# 2  Vendor (0x50)       Completed without error       00%      7310         -
# 3  Short offline       Completed without error       00%      7310         -
# 4  Vendor (0x50)       Completed without error       00%      6644         -
# 5  Short offline       Completed without error       00%      6644         -
# 6  Vendor (0x50)       Completed without error       00%      3087         -
# 7  Short offline       Completed without error       00%      3087         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

The above only provides legacy SMART information - try 'smartctl -x' for more

1 Like

Those indicate the disk is defect. Backup what still can, and forget that disk.

3 Likes

Any package/software help me get my data back from HDD

Found Testdisk, Photorec or Qphotorec using them can I get back

The first thing I’d try is to create an image of the defect disk with ddrescue. This is the hardest part.

https://linux.die.net/man/1/ddrescue
I don’t use Fedora, so have no idea which package it is in.
After that I’d loop mount the defect disc image, and run photorec on that image.

After executing losetup -Prf the rest of the system will see the image as /dev/loop##, lsblk wil report it too.

Then you can run photorec against that “drive”.

Edit:
This is a 1TB disk, expect the resulting image to be that size.
Another big space is required where photorec will sotre what it finds.

4 Likes

Ill prefer testdisk…its really good…photorec is also awesome…i even recovered encrypted files by ransomeware using it.

But see this, testdisk tries to make the partition usable and fix the partition while photorec tries to recover files…

Once my Sanskrit teacher gave a sd card to me which was not showing the files on it in her phone…

So i brought it home, used the sd card to usb coverter and plugged it into my linux machine. Then I simple used testdisk to recover the partitions. Let me tell u that it didnt even take a bit of storage on my 256gb ssd(except the space taken by testdisk tool) and it directly repaired the filesystem on the sd card and it was now readable, writable!

So ill recommend to try that.
Corrections if any pls tell @Senior Members

3 Likes

Indeed Testisk is worth to try too.
But do it on a copy of the rescued disk image. So in case it fails, doesn’t make things worse. For that loop mount the image read/write mode.

4 Likes

Yeahh that would be safer actually…

1 Like