1

I have a slightly messed-up 64GB USB drive formatted with FAT32, and would like to fix it on Ubuntu 18.04.

First attempt:

$ sudo fsck.vfat /dev/sdc1 
fsck.fat 4.1 (2017-01-24)
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT
? 1
Reclaimed 4221 unused clusters (138313728 bytes).
Free cluster summary wrong (1484695 vs. really 1488915)
1) Correct
2) Don't correct
? 1
Perform changes ? (y/n) y
/dev/sdc1: 20 files, 402763/1891678 clusters
$

However, when I re-mount the drive afterwards, the corrupt files show up again and resist any attempt to delete them. I can re-run the command as often as I want, with exactly the same result.

Second attempt, based on How to repair a corrupted FAT32 file system:

$ sudo fsck.vfat -w -r -v -l -a -t /dev/sdc1 
fsck.fat 4.1 (2017-01-24)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "THREES  "
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
     32768 bytes per cluster
        32 reserved sectors
First FAT starts at byte 16384 (sector 32)
         2 FATs, 32 bit entries
   7567872 bytes per FAT (= 14781 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 15152128 (sector 29594)
   1891678 data clusters (61986504704 bytes)
63 sectors/track, 32 heads
        63 hidden sectors
 121097025 sectors total
FATs differ but appear to be intact. Using first FAT.
Checking file /
[...]
Checking for bad clusters.
Reclaiming unconnected clusters.
Reclaimed 4221 unused clusters (138313728 bytes) in 1 chain.
Checking free cluster summary.
Free cluster summary wrong (1484695 vs. really 1484694)
  Auto-correcting.
Performing changes.
/dev/sdc1: 21 files, 406984/1891678 clusters

Same result: fsck finds errors, acts like it fixes them, but the filesystem appears to be entirely unchanged afterwards and all the corrupt files are still there.

Filesystem has been unmounted before fsck, of course. What am I missing?

  • This link can help you analyze the problem, and if you are lucky, solve it. – sudodus Jun 09 '19 at 11:24
  • 2
    It is possible that the drive is 'gridlocked', which means that it seems to be OK, but is actually read-only (the hardware is read-only). This is sometimes the first stage of failure. But if you are lucky, there is another error, and you can get rid of the problem. I suggest that you start by copying all the files (that you want to keep) to another drive. After that you can 1. Try to repair the drive in a computer with Windows: 2. If still no success, try to wipe the first mibibyte of the drive and after that create a fresh partition table and file system. – sudodus Jun 09 '19 at 11:29
  • 1
    Thanks - this does indeed seem to be the case. Haven't heard the term "gridlock" before, but it fits - I've tried to wipe the partition table with dd, but after re-plugging the device, everything was back like nothing happened, i.e. all writes seem to fail silently. – Florian Echtler Jun 09 '19 at 13:16
  • If you post your second comment as an answer, I can accept it, because it did point me in the right direction. – Florian Echtler Jun 09 '19 at 16:37

1 Answers1

0

It is possible that the drive is 'gridlocked', which means that it seems to be OK, but is actually read-only (the hardware is read-only). This is sometimes the first stage of failure.

But if you are lucky, there is another error, and you can get rid of the problem.

  • I suggest that you start by copying all the files (that you want to keep) to another drive.
  • After that you can try to repair the drive in a computer with Windows.
  • If still no success, try to wipe the first mibibyte of the drive and after that create a fresh partition table and file system.

There are more details at this link.

sudodus
  • 46,324
  • 5
  • 88
  • 152