hard disk crashed, how can rescue my data

erselbst

New Member
Credits
36
Hello!

Yesterday my Linux stopped (froze). I simply switched off the notebook, then switched it on again. Unfortunately, the system can no longer be started. There are faulty blocks on the hard disk. I installed my Linux Mint two years ago so that the first partition (sda1) is SWAP and the second partition (sda2) is the root partition. The root partition is also the boot partition (EFI). Unfortunately, I can no longer access my data because the hard disk cannot be mounted with a Live USB.

How can I save my data? Is there a way to repair the hard drive?

Here are a few values for my hard drive:




[email protected]:~$ sudo fdisk -l /dev/sda
Disk /dev/sda: 238,49 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SanDisk SD8SNAT-
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000a2bf9

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 2000895 1998848 976M 82 Linux swap / Solaris
/dev/sda2 * 2000896 500118083 498117188 237,5G ef EFI (FAT-12/16/32)





[email protected]:~$ sudo fsck.ext4 /dev/sda2
e2fsck 1.45.5 (07-Jan-2020)
fsck.ext4: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda2
Could this be a zero-length partition?



[email protected]:~$ sudo file -s /dev/sda2
/dev/sda2: Linux rev 1.0 ext4 filesystem data, UUID=1faec859-d1e0-449c-8a0f-9bd4bb8a08c2 (needs journal recovery) (extents) (64bit) (large files) (huge files)



[email protected]:~$ sudo badblocks /dev/sda2
108
109
110
111
192691596
192691597
192691598
192691599
192728880
192728881
192728882
192728883
192728884
192728885
192728886
192728887
192728888
192728889
192728890
192728891
192728892
192728893
192728894
192728895




[email protected]:~$ sudo smartctl -a /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-26-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: SanDisk SD8SNAT-256G-1006
Serial Number: 164299420433
LU WWN Device Id: 5 001b44 4a66fc737
Firmware Version: Z2311006
User Capacity: 256.060.514.304 bytes [256 GB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: Solid State Device
Form Factor: M.2
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 T13/2015-D revision 3
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed Sep 22 20:03:51 2021 UTC
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: ( 120) seconds.
Offline data collection
capabilities: (0x11) SMART execute Offline immediate.
No Auto Offline data collection support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
No 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: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 10) minutes.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 100 100 050 Pre-fail Always - 0
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 2
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 249
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 1050
171 Unknown_Attribute 0x0022 100 100 000 Old_age Always - 0
172 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0
173 Unknown_Attribute 0x0033 100 100 005 Pre-fail Always - 99
174 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 22
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 100 000 Old_age Always - 3
194 Temperature_Celsius 0x0022 083 055 000 Old_age Always - 17 (Min/Max 0/45)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 2
199 UDMA_CRC_Error_Count 0x0032 100 100 000 Old_age Always - 2
230 Unknown_SSD_Attribute 0x0032 100 100 000 Old_age Always - 832
244 Unknown_Attribute 0x0032 000 100 000 Old_age Always - 0

SMART Error Log Version: 255
Warning: ATA error count 65535 inconsistent with error log pointer 2

ATA Error Count: 65535 (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 65535 occurred at disk power-on lifetime: 65535 hours (2730 days + 15 hours)
When the command that caused the error occurred, the device was in a vendor specific state.

After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
ff ff ff ff ff ff ff

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]

Error 65534 occurred at disk power-on lifetime: 65535 hours (2730 days + 15 hours)
When the command that caused the error occurred, the device was in a vendor specific state.

After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
ff ff ff ff ff ff ff

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]

Error 65533 occurred at disk power-on lifetime: 65535 hours (2730 days + 15 hours)
When the command that caused the error occurred, the device was in a vendor specific state.

After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
ff ff ff ff ff ff ff

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]

Error 65532 occurred at disk power-on lifetime: 65535 hours (2730 days + 15 hours)
When the command that caused the error occurred, the device was in a vendor specific state.

After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
ff ff ff ff ff ff ff

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]
ff ff ff ff ff ff ff ff 49d+17:02:47.295 [VENDOR SPECIFIC]

Error 65531 occurred at disk power-on lifetime: 0 hours (0 days + 0 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
-- -- -- -- -- -- --
00 00 80 80 1e 18 00

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
b0 d0 01 00 4f c2 00 08 00:00:00.000 SMART READ DATA
b0 d1 01 01 4f c2 00 08 00:00:00.000 SMART READ ATTRIBUTE THRESHOLDS [OBS-4]
b0 da 00 00 4f c2 00 08 00:00:00.000 SMART RETURN STATUS
b0 d5 01 00 4f c2 00 08 00:00:00.000 SMART READ LOG
b0 d5 01 01 4f c2 00 08 00:00:00.000 SMART READ LOG

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 249 -

Selective Self-tests/Logging not supported




[email protected]:~$ blkid
/dev/sda2: UUID="1faec859-d1e0-449c-8a0f-9bd4bb8a08c2" TYPE="ext4" PARTUUID="000a2bf9-02"
/dev/sdb1: UUID="2020-06-24-19-01-47-00" LABEL="Linux Mint 20 Cinnamon 64-bit" TYPE="iso9660" PTUUID="4089a39b" PTTYPE="dos" PARTUUID="4089a39b-01"



[email protected]:~$ lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0 squashfs 0 100% /rofs
sda
├─sda1 swap 0e36faff-1580-468c-bc41-8bdef49fcfe4 [SWAP]
└─sda2 ext4 1faec859-d1e0-449c-8a0f-9bd4bb8a08c2
sdb iso9660 Linux Mint 20 Cinnamon 64-bit 2020-06-24-19-01-47-00
├─sdb1 iso9660 Linux Mint 20 Cinnamon 64-bit 2020-06-24-19-01-47-00 0 100% /cdrom
├─sdb2 vfat 1AC3-20ED
└─sdb3 ext4 writable 4c7c3bec-2ff8-4dc5-9c2e-f3ea67fa4a7d 26G 0% /var/log



[email protected]:~$ sudo fsck /dev/sda2
fsck from util-linux 2.34
e2fsck 1.45.5 (07-Jan-2020)
fsck.ext4: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda2
Could this be a zero-length partition?


I would be very grateful for any helpful tips and advice.
 

Attachments



Tolkem

Well-Known Member
Credits
8,523
From the initramfs prompt, try running
Code:
fsck -y /dev/sda2
I'm not 100% sure, but I think had a similar issue and that solved it, so it may or not work in your case, however, it wouldn't hurt to try. :)
 

Alexzee

Well-Known Member
Credits
9,213
Does your notebook have a cdrom drive?

This may help:

 

erselbst

New Member
Credits
36
Hello, I hope you had a nice weekend ;)

In the case of my hard drive it did not go so nice. After this post I had tried some more things to fix the faulty blocks, but don't remember exactly what I did there :-(

@Tolkem: this I have already tried, which does not work (see post above)

@Alexzee: this is an interesting article, might work if I didn't have a new problem now. I think that my disk was full to about 1GB. The cause of freezing and not booting again could be a full disk.

Now unfortunately I can't get into initramfs, the computer can't find an OS (see picture). Somehow I must have shot the partition table :-(

Fix MBR I have also tried, without success. Does anyone know how I can get the harddisk bootable again, so that I can do the things mentioned in the article via initramfs?

Many greetings
erselbst
 

Attachments

Fanboi

Active Member
Credits
3,665
If you had any data of value on that partition, I would've suggested cloning it with dd before doing anything. At least you can mount the image and save your data. Anyway, what's done is done, but it's never too late if there's personal or important data (work, hobbies, plans for world domination, pirated clown pron, etc.) on sda2. It's fine if your data is on another partition. However, back it up now.
Re booting, you may as well YOLO this:
- Boot in a LiveCD
- Use Gparted to resize the partition. This may "fix" it by rewriting the partition and fs info.
- Now of course this means that the partition's UUID has changed so you will have to change various configuration.
- Exit Gparted and mount sda2
- blkid to get the new UUID. Copy+paste it somewhere.
- Edit "/etc/fstab" and /boot/grub/grub.cfg and update the information (you can fix the rest lately)
- Reboot and try. If no luck, boot from LiveCD and try running "update-grub /dev/sda". Try rebooting again.

If ya need me to elaborate any of these steps, feel free to. I, or someone else, will explain.
 

erselbst

New Member
Credits
36
Hello!
First of all, thanks for the tip. I first tried with Live/USB and gparted to change the disk size. sda1 I have reduced to 512M, and then wanted to increase sda2, which does not work (gparted.png).

Then I tried to fix sda2 with disks. This did not work either (disks.png).

If I save the data from sda2 with dd on an external harddisk, how should I be able to access the data. This is then a 1:1 image with the same bad blocks?

Thanks and best Regards
Erselbst
 

Attachments

Alexzee

Well-Known Member
Credits
9,213
What is the output of:

cat /var/log/fsck/checkfs

Do you have a Live CD/DVD of Linux?
Boot into that and than find your external HDD and copy the data that way.
 

Fanboi

Active Member
Credits
3,665
erselbst said:
Hello!
First of all, thanks for the tip. I first tried with Live/USB and gparted to change the disk size. sda1 I have reduced to 512M, and then wanted to increase sda2, which does not work (gparted.png).

Then I tried to fix sda2 with disks. This did not work either (disks.png).
You may have to wipe the partition table itself (effectlively wiping everything). However, this looks like it could be physical. If you're using an SSD, then there's a strong possibility your drive is on its last legs. As @Alexzee said, that checkfs info may shed some light on it. In the meantime...

erselbst said:
If I save the data from sda2 with dd on an external harddisk, how should I be able to access the data. This is then a 1:1 image with the same bad blocks?
Yes, that's the point. You need to backup data ASAP. A 1:1 clone can sometimes have data that's screwed retrieved. For example, you could partially retrieve an image using a forensic tool and dd'ing the partial file to, say, "retrieved.png" (wouldn't get my hopes up restoring a jpeg unless the header's intact). Anyway, the less rw activity since fail, the more you may be able to salvage. As for your uncorrupted files, they'll copy straight accross once the raw image is mounted. This means you can mess with the physical ssd/hdd as much as you want once you have that cloned partition (sda2) safely on another drive/uploaded to cloud/whatever.
 

Alexzee

Well-Known Member
Credits
9,213
It's been my experience that when a HDD is on it's last leg a Linux installation will not work.

In other words if you try to to install Linux on a HDD that is on it's way out the install won't take.
I've tried it 3 times on a drive that died on me.
 

Fanboi

Active Member
Credits
3,665
It's been my experience that when a HDD is on it's last leg a Linux installation will not work.

In other words if you try to to install Linux on a HDD that is on it's way out the install won't take.
I've tried it 3 times on a drive that died on me.
3 times? That's dedication. TBH, I'd dump the HDD or SSD, plug in a 64GB+ USB3 thumbdrive. Performance is pretty good (considering).

OP:
I thi k the main lessin here is redundbnc
I think the main lesson here is redundancy.

The second lesson is to keep data and OS on separate drives. Hopefully you can mount that sda2 clone on another PC or when yours is fixed and retrieve what you can. With luck, you'll only lose a few of those embarrassing Christmas pics with everyone wearing hideous reindeer knitwear.
 

Alexzee

Well-Known Member
Credits
9,213
3 times? That's dedication. TBH, I'd dump the HDD or SSD, plug in a 64GB+ USB3 thumbdrive. Performance is pretty good (considering).

OP:
I thi k the main lessin here is redundbnc
I think the main lesson here is redundancy.

The second lesson is to keep data and OS on separate drives. Hopefully you can mount that sda2 clone on another PC or when yours is fixed and retrieve what you can. With luck, you'll only lose a few of those embarrassing Christmas pics with everyone wearing hideous reindeer knitwear.
Yeah, dedication indeed.
I just did not want to part with that HDD that came with my old desktop.
The HDD died on me a month before the 5 year warranty was up. So,

I sent the old HDD to the company {ZT Systems} that made the desktop and they sent me a new 1 TB drive-:) !!!

I hope that OP can mnt that drive and cp his data.
 

Tolkem

Well-Known Member
Credits
8,523
@Tolkem: this I have already tried, which does not work (see post above)
Yeah, I did see that, but you tried, from a Mint's Live USB? I was suggesting to run fsck from the initramfs prompt, but you said that you're not getting that anymore. I agree with some that it looks like a hardware issue(possibly HDD/SSD's last leg)
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top