LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 01-24-2018, 08:45 PM   #1
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
Unhappy corrupted ext2 filesystem on usb flash drive


Just fubar'd my usb flash drive and want to understand, if possible, what happened, so as to avoid future repeats.

The flash / thumbnail drive is a Kingston 8G, about 2 - 3 years old. Shortly after purchasing it, I partitioned it as per this fdisk report:
Code:
Disk /dev/sdb: 7747 MB, 7747397632 bytes
239 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 14818 * 512 = 7586816 bytes
Disk identifier: 0x0008bca9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          48      355601    c  W95 FAT32 (LBA)
/dev/sdb2              49         768     5334480   83  Linux
/dev/sdb3             769        1021     1874477   82  Linux swap / Solaris
Earlier today I took it to a local photocopy place here in Nicaragua to have a document scanned, and gave the flash drive to the girl to copy the scanned pdf file onto it. She copied the pdf file to the FAT32 partition and I'm able to read that partition fine.

When I got back home and started my old Dell running an old Linux (Debian/Mepis) with the flash drive plugged in, I could mount the Linux partition and see the various directories and files, but was getting read errors. When I unmounted the partition and ran e2fsck, I got so many errors that i aborted and ran e2fsck again with the -y option to automatically answer Yes to fix all errors. Now I was unable to even mount the drive; the superblock was now apparently corrupted. Re-running e2fsck still reported a corrupted filesystem and reported what appeared to be the same errors that the first run had reportedly fixed.

Then I rebooted to a newer Mepis and tried using that e2fsck with the -y switch. This time e2fsck fixed the same(?) problems and left me with a clean drive which i can mount and read. But all my directory structures are gone and all data now resides in numbered files within the lost+found directory. All the data appears to be there, but it will be an impossible task to try to match the numbered files in lost+found to my original directory structure and filenames. (Plus, many of the numbered files have strange files permissions.) The mess is unrecoverable, and I will have to reformat the whole partition and rebuild all my data from scratch.

Perhaps (?) the photocopy place's Windows system, failing to recognize the second partition, had prompted the girl to format that partition, and she clicked 'OK' and then aborted the format when she realized her mistake. This is pure speculation on my part. The filesystem was not reformatted; it is still a type 83 Linux partition and somewhere there still exist the directories and filenames pointing to the old inode numbers. Why and how did e2fsck further corrupt everything? What ought I to have done instead of e2fsck?
 
Old 01-24-2018, 09:32 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Windows should not have seen the second partition easily I'd think.

ext2 is kinda bad for a usb I'd think unless you have no other choice. Switch to ext4.

I'd suspect that esd or some voltage issue/unplugged hot caused it.

Guess it could be some malware. Those public places are subject to a wide array of problems.

Drive could be going bad.
 
1 members found this post helpful.
Old 01-25-2018, 08:58 AM   #3
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490

Original Poster
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
Thank you for your thorough reply.

Quote:
Originally Posted by jefro View Post
Windows should not have seen the second partition easily I'd think.
I think that was true a few years ago, which was one big reason i partitioned the drive as i did - to protect my important data from public Windows computers. Depending upon how it's configured (I guess), the newer Windows can see the second partition but can't read it, and therefore prompts the operator to format it.
Quote:
Originally Posted by jefro View Post
ext2 is kinda bad for a usb I'd think unless you have no other choice. Switch to ext4.
For now, I need it to be compatible with my 10-year-old Linux Mepis system. But will look into this possibility when i buy a new drive. Ext3 is also a journaled system, no? Or what about formatting as Reiser?
Quote:
Originally Posted by jefro View Post
I'd suspect that esd or some voltage issue/unplugged hot caused it.
I NEVER unplug it hot. Perhaps the operator did. (What is 'esd'?)
Quote:
Originally Posted by jefro View Post
Guess it could be some malware. Those public places are subject to a wide array of problems.
Yes. Am trying to wean myself of cyber cafes, etc, but that ain't easy down here in Nicaragua.
Quote:
Originally Posted by jefro View Post
Drive could be going bad.
A possibility.

Taking all into consideration, probably my best option is to buy another new stick and use it exclusively for my Linux backups that never leaves home. I already have a second backup stick - or, rather, the one that went bad was my second, so no panic issue. And then reformat the corrupted one as FAT32 for exclusive public transfer use.

Last edited by dogpatch; 01-25-2018 at 09:02 AM. Reason: close unclosed quote
 
Old 01-25-2018, 09:11 AM   #4
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490

Original Poster
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
Still no clue as to what went wrong with the e2fsck process, why it corrupted the filesystem even worse than it was originally. It was a 10-year-old (or older?) e2fsck, part of my old Mepis(Debian) system. Any thoughts on that?
 
Old 01-25-2018, 12:07 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by dogpatch View Post
Taking all into consideration, probably my best option is to buy another new stick and use it exclusively for my Linux backups that never leaves home. I already have a second backup stick - or, rather, the one that went bad was my second, so no panic issue. And then reformat the corrupted one as FAT32 for exclusive public transfer use.
That sounds like a good strategy to me.

Out of interest, can I ask why you marked the thread as "Solved" when the cause of the problem hasn't yet been determined? It means that some folk who may be able to add further observations might avoid reading the thread as they think that the issue has been resolved.
 
Old 01-31-2018, 10:43 AM   #6
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490

Original Poster
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
Quote:
Originally Posted by hydrurga View Post
Out of interest, can I ask why you marked the thread as "Solved" when the cause of the problem hasn't yet been determined? It means that some folk who may be able to add further observations might avoid reading the thread as they think that the issue has been resolved.
Marked it as Solved after post #3 above, when I had arrived at the aforementioned strategy for avoiding future problems. Post #4 was an afterthought.

But you're right, it would still be good to learn what went wrong with the e2fsck process. Will try to remove the 'Solved' tag from this thread, if I can.
 
Old 01-31-2018, 01:27 PM   #7
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
When you have lost your boot blocks there are other super blocks that you can use to replace the faulty one, which then allows complete access to your data again.

(About half way down the page.)
https://www.slashroot.in/understandi...perblock-linux
 
Old 01-31-2018, 03:00 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
ext2 stunk and it had/has very few ways to correct from disaster.

Flash drives are unreliable.

Taking storage to unknown locations is a recipe for disaster.
 
  


Reply

Tags
corrupt, e2fsck, ext2, flash drive, usb



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
[SOLVED] questions about a usb flash drive that might be corrupted Gregg Bell Linux - Newbie 23 05-08-2017 11:39 AM
Filesystem on flash via mtdblock corrupted after umount Refractor Linux - Software 1 06-27-2013 07:13 PM
USB drive filesystem corrupted rock.hopper Linux - General 7 10-19-2011 02:41 PM
Corrupted USB flash drive needs fixing (Fedora/Linpus) redmittens Linux - Hardware 7 02-14-2010 12:06 PM
usb flash drive / ext2 oddness slimjim Linux - Hardware 3 01-03-2007 05:20 PM

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

All times are GMT -5. The time now is 07:57 AM.

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