2

A while ago, I wrote an image on a USB drive using something along these lines:

dd bs=4M if=/path/to/image.iso of=/dev/sdb && sync

Something must have gone terribly wrong there because after using the drive once or twice, Ubuntu didn't automount it anymore. So, I decided to overwrite the partition table first, since the image partition table is not a standard table. So I did:

dd count=1 bs=512 if=/dev/zero of=/dev/sdb && sync

After that, Ubuntu suddenly mounted the drive again and I could actually access the image. This is funny, since I basicaly erased the partition table. So, I tried:

cfdisk /dev/sdb

However, cfdisk shouted FATAL ERROR: cannot open disk drive. So, I tried gparted and created a new partition table. Now, the drive is automounted but I was suspicious of the whole thing, so I tried fsck.msdos and this is the very unsettling message I got:

prompt@prompt:~$fsck.msdos /dev/sdb
dosfck 3.0.12, 29 Oct 2011, FAT32, LFN,
Currently, only 1 or 2 FATs are supported, not 251.

However, if I check the partition table with fdisk I get no error messages, nothing, just a clean table with one partition:

Disk /dev/sdb: 4004 MB, 4004511744 bytes
218 heads, 51 sectors/track, 703 cylinders, total 7821312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00095e47

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     7821311     3909632    b  W95 FAT32

So, the only option I see now is zeroing out the first sector which is how all this started in the first place. I'm going to try zeroing the complete device and report back with results. Don't hesitate to give me other suggestions though.

5
  • Why fsck.msdos instead of fsck.vfat? msdos is FAT12 and you want FAT32. If the drive is currently working, I don't see what the problem is.
    – terdon
    Apr 25, 2014 at 10:21
  • Ahaaa! I see, that explains a lot. I don't remember exactly where I found this command but I googled it. Next time I should read the manpage. Apr 26, 2014 at 8:23
  • All flash drives wear out. After a limited no. of reads and writes, the chip inside them simply dies. I have seen similar symptoms on a lot of drives that were near their end of life. So I guess..
    – itsfarseen
    Apr 10, 2016 at 4:18
  • btw, how did the zeroing go?
    – itsfarseen
    Apr 10, 2016 at 4:19
  • Not too well, I think the drive was broken in the first place. It stopped working after zeroing out the first sector. So yeah, your're right. It was surprising though, since the drive wasn't very old. Apr 12, 2016 at 12:42

2 Answers 2

0

Wipe the first mibibyte

It is usually enough to wipe (overwrite with zeros) the first mibibyte to get rid of data, that can confuse the programs that use or create partition tables and file systems.

You can do that with dd similar to what you did with the first 512 bytes. But dd is risky, so I would recommend mkusb, which 'wraps a safety belt around dd'. There are also other tools, that are safer than dd, for example Disks alias gnome-disks.

Zeroing out the whole drive should work, but it is slow, and will cause unnecessary wear of the memory cells. I use it only, when the drive is getting slow (in order to make it fast again and restore the margin to 'gridlock'. See this link: Pendrive lifetime

Cloning

The cloning process is very reliable, when done correctly with dd, mkusbor some other cloning tool.

So I think that your problem depends on the partition table and/or file systems, that come from the image file (image.iso), or was caused by a bad or incomplete shutdown, that corrupted the file system.

You must not unplug the USB drive while some partition on it is still mounted. It is important to let the system flush the buffers, finish writing data from RAM to the partition's file system.

0

I fixed the same error using Kde-parted.

I got this error and neither fsck.vfat nor dosfsck fixed it

So I made a new FAT, with before unmount, marked the partition, at top, device, make new FAT, or ctrl-shift-N.

Then format made a new partition and everything worked normally again.

2
  • I don't really understand what you did. Can you clarify the steps at all?
    – Zanna
    May 27, 2018 at 16:08
  • This helped me in one situation( Where the partition was present but sperblock was not accessible ) . But in other one it dindnt . thanks for the one atleast.
    – yunus
    Jun 8, 2020 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .