LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-20-2014, 02:14 PM   #1
People'spoet
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Rep: Reputation: Disabled
How long will Fsck take to fix my flash drive? -- vfat drive, Fedora 20 computer.


Dear all,

I wonder whether you could help with a query:--

I have a flash drive of 64 GB with a bunch of corrupt files on it (all in a single directory). I asked fsck to scan the drive and it offered to fix this directory, noticing that it is corrupt. How long should it take?

The size of the corrupt directory is confusing -- file manager claims that it is around 50 GB (which is probably nonsense because, with the other data, that would exceed the capacity of the flash drive. File manager, for 'Properties' shows the memory-usage pie chart shows that I would expect prior to corruption, a bunch of data with a little space (around 53 GB), but claims that the drive contains 103.1 GB in total (on a 64 GB drive!).

So basically, fsck is scanning what claims to be 50 GB of data (but was around 2 GB before it corruped). It's been working for around 8 hours, you could fry an egg on my laptop's heat-sink and fsck is running on around 99% CPU.

I'm using a Thinkpad X60 (32-bit, Fedora 20), 3GB RAM and a 2.00GHz × 2 Intel processor.

So, any ideas on how much longer it will take?

Thanks for the help,

Oliver
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2014-05-20 20:12:25.png
Views:	44
Size:	179.3 KB
ID:	15545  
 
Old 05-20-2014, 04:03 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by People'spoet View Post
I have a flash drive of 64 GB with a bunch of corrupt files on it (all in a single directory). I asked fsck to scan the drive and it offered to fix this directory, noticing that it is corrupt. How long should it take?
that's very hard to tell. It depends very much on the number of files - and hey, about 170'000 files is an awful lot!
Your screenshot reports "msdos" as the file system being used; on Linux's behalf, that's a generic term including all FAT variants (i.e. FAT12, FAT16 and FAT32). A Windows file system anyway. So I would prefer to have it checked and repaired by a native Windows machine, or at least by a real Windows in a VM.

Actually, I've never run a Linux fsck on a FAT file system, but I know that fsck takes ages even for a routine check of an ext3 volume. Whenever my computer decides to run a routine check on the 400GB data partition (which is about 3/4 full), that takes about 20..30 minutes. And that is without errors to be fixed!

Quote:
Originally Posted by People'spoet View Post
So basically, fsck is scanning what claims to be 50 GB of data (but was around 2 GB before it corruped). It's been working for around 8 hours, you could fry an egg on my laptop's heat-sink and fsck is running on around 99% CPU.
That's a very clear indication that something's going wrong. Usually, fsck spends a lot of time waiting for the HDD (or for whatever storage medium you're using). A CPU load near 100% means that fsck is hardly accessing the storage device any more, but is rather locked up in some sort of infinite loop chewing on data cached in RAM. Maybe the FAT indicates a cluster chain that forms a loop, and fsck is checking this loop over and over again? Weird things can happen ...

Quote:
Originally Posted by People'spoet View Post
So, any ideas on how much longer it will take?
Forever, is my guess. Unless you stop it.

[X] Doc CPU
 
Old 05-20-2014, 04:37 PM   #3
People'spoet
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for the info! As you say, something appears to be wrong, perhaps it's something to do with the fact that my system can't decide how much data there is? Some kind of recursion?

As such, you wouldn't happen to know another way of deleting a whole directory of corrupt files? Every time I try to do so, the whole drive goes read-only -- can't change permissions, can't rm -f.

Thanks,

Oliver
 
Old 05-21-2014, 03:09 AM   #4
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by People'spoet View Post
As you say, something appears to be wrong, perhaps it's something to do with the fact that my system can't decide how much data there is?
the mismatch between total capacity, available space and the cumulated size of all files is a clear indication for something wrong. What it really is and how it happened - no idea.

On a FAT file system, there are two ways to determine the amount of space allocated:
a) scan the FAT and count all non-free blocks
b) scan all directories and recursively sum up file sizes
When you query the media's properties, the FAT driver typically uses the first method because it's fast and produces accurate results. When you query the properties of a directory in your file manager, it uses the second method because it's versatile and can also be applied to individual directories, while a) always considers the entire volume. Usually, the amount of allocated space computed that way is less than what method a) indicates. That's because the space is always given or taken as entire blocks (clusters), which are typically 4kB with FAT, regardless of the actual file size. So even a small text file of 182 bytes is occupying 4kB of the volume's space.

In your scenario, however, it's the other way round: The accumulated file size is bigger than the total space used on the volume, it's even bigger than the total capacity. Clearly wrong.

Quote:
Originally Posted by People'spoet View Post
Some kind of recursion?
Could be. Or multiple records in a directory referencing the same cluster chain. In Unix file systems this feature is known as "hardlinking" a file. But in FAT it's not officially supported and thus considered an error. There are no tools to create such a structure deliberately, and usually FAT drivers can't deal properly with it.

Quote:
Originally Posted by People'spoet View Post
As such, you wouldn't happen to know another way of deleting a whole directory of corrupt files?
I'm afraid no. As I said, I'd recommend to run a file system check on a Windows PC. My experience is that Windows's chkdsk (or scandisk) can deal with these problems fairly well. It'll try to recover logical errors, e.g. make cross-linked files into two separate files. Of course, there's a certain risk that some of the files are already shaken up or truncated in a way that can't be recovered.

Tell you what I would do: Copy the entire contents from the bad volume to another. Maybe some files can't be copied any more because their structure is damaged. But the duplicate of those that can will be fully accessible again.
Then re-format the FAT volume.

[X] Doc CPU
 
Old 05-21-2014, 04:54 AM   #5
People'spoet
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
I've checked and fortunately, as the drive was a backup, I haven't actually lost any unique data. As such, I've re-formatted it and started the backup again. Thanks for all the help and guidance! First linux problem that I couldn't fix, you know? Either on my own or with the help of forums -- though I guess its party a MSDOS problem!

Thanks again,

Oliver
 
  


Reply

Tags
corrupted, fsck, time



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
Can I change the (long, long) UUID of a USB flash drive to something short? Zwergele Linux - Newbie 6 11-10-2013 09:55 AM
FSCK or similar help please. Must fix corrupted drive. AbeFM Linux - Hardware 11 12-19-2012 02:56 AM
Removed bad hard drive from computer, now flash drive won't mount. checkmate3001 Linux - Hardware 6 08-15-2008 12:03 AM
I ran fsck.vfat to repair hard drive, and got a bunch of .REC files ! wearetheborg Linux - Hardware 12 04-14-2007 05:54 AM
Can't mount flash drive with vfat? maq Linux - Hardware 2 04-10-2005 04:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:05 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