LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-29-2020, 08:28 PM   #16
ab1jx
Member
 
Registered: Feb 2017
Posts: 119

Rep: Reputation: Disabled

Quite a common occurrence to those of us who use SD cards instead of hard drives (Raspberry Pi, etc.). They mostly only last a couple years at most.

I used to work with failing floppy disks a lot and got in the habit of copying all the sectors off to something else at the start as a backup. If the physical drive is failing your problems are only going to get worse. Once you've backed it up you can write it back out to another drive or do a loop mount and tinker with salvaging stuff, knowing it's stable and not going to get worse. So I'm doing
dd if=/dev/sda2 of=stuff.dat bs=1M status=progress
which will take at least a few hours. Assuming I can edit this I'll update it.
 
Old 09-29-2020, 08:59 PM   #17
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,340

Rep: Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177Reputation: 4177
The prior post was 15 years ago - I doubt this is still something they care about.
 
Old 09-29-2020, 09:00 PM   #18
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by ab1jx View Post
Quite a common occurrence to those of us who use SD cards instead of hard drives (Raspberry Pi, etc.). They mostly only last a couple years at most.

I used to work with failing floppy disks a lot and got in the habit of copying all the sectors off to something else at the start as a backup. If the physical drive is failing your problems are only going to get worse. Once you've backed it up you can write it back out to another drive or do a loop mount and tinker with salvaging stuff, knowing it's stable and not going to get worse. So I'm doing
dd if=/dev/sda2 of=stuff.dat bs=1M status=progress
which will take at least a few hours. Assuming I can edit this I'll update it.
Using dd might also fail if there actually is a bad block. dd also does a bit for bit copy so any errors on the original will be in the copy even if it completes.

I seem to recall that someone used a utility called photorec to recover from a situation such as yours although I have not seen nor tried that. Apparently photorec only copies/recovers the actual data that is readable without the errors that exist in the original so it does not have the size requirements nor error copying problems associated with using dd to copy a disk partition that has errors.
 
Old 09-30-2020, 12:02 AM   #19
ab1jx
Member
 
Registered: Feb 2017
Posts: 119

Rep: Reputation: Disabled
It worked somewhat. I copied stuff.dat (made by dd) to another file as another backup level. Then mke2fs -n stuff.dat &> superblocks.txt. Then fsck.ext4 -y -b 32768 stuff.dat and ignored what fsck said basically because there was a ton of it. Then mount -o loop stuff.dat /mnt and looked around /mnt with mc. All the files were in a subdir of lost+found so I copied them out into a regular dir on my SSD and umounted /mnt.

They're close enough, I can ignore some errors in them. They're just wav files from a night's nature recordings, they don't matter that much. I still have the backup file from when I copied before I ran fsck, plus the original SD but I probably won't bother with them. This was a 32 GB SD and I have a mostly empty 2 TB SSD to play with. I could have done a dd to another SD if I'd needed the space. But my first priority was always preserving the original data untouched.
 
Old 09-30-2020, 12:37 PM   #20
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,280

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Just for reference, I've had good results on large partitions with:

e2fsck -b 98304

Ant that number is fairly easy to remember.
 
Old 09-30-2020, 01:04 PM   #21
ab1jx
Member
 
Registered: Feb 2017
Posts: 119

Rep: Reputation: Disabled
I wonder how big a superblock is? If you could read all the ones that mke2fs finds and compare them, leave out the outliers and use the biggest block where they're all the same. Sort of a voting process. If a bunch agree they're probably right, then you could pick any of those. A programming project that's about my speed. Run mke2fs in a pipe and catch the numbers it feeds back, then read all of those into arrays and compare.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount: wrong fs type, bad option, bad superblock on /dev/hdc3 Lordandmaker Linux - Hardware 15 06-05-2011 09:55 AM
mount: wrong fs type, bad option, bad superblock on /dev/cdrom, Adil_uk Linux - Hardware 9 02-16-2005 06:50 PM
bad superblock, corupt data, dd, Oh my! veroth Linux - General 2 03-17-2004 11:55 AM
mount: wrong fs type, bad option, bad superblock on /dev/sdb1 pmoreira Linux - Hardware 5 02-26-2004 11:31 AM
wrong fs type, bad option, bad superblock on /dev/hdb1, ldare Linux - Hardware 1 02-12-2004 10:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration