LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Corrupted filesystem FAT16 on USB stick. It mounts read-only. (https://www.linuxquestions.org/questions/linux-general-1/corrupted-filesystem-fat16-on-usb-stick-it-mounts-read-only-4175483588/)

colucix 11-06-2013 07:29 AM

Corrupted filesystem FAT16 on USB stick. It mounts read-only.
 
Hi all. I have a 2Gb USB stick formatted as FAT16. For some unknown reason I cannot mount it r/w anymore. dmesg reports the following error:
Code:

FAT: Filesystem error (dev sdb1)
    fat_get_cluster: invalid cluster chain (i_pos 0)

I can read almost all the files inside it, but I cannot write and I cannot format it again. I tried to run fsck and it reports the following
Code:

# fsck -a /dev/sdb1
fsck from util-linux-ng 2.17.2
dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN
open: Read-only file system

I also tried to write down /dev/zero using dd, but nothing. I tried even from a Windows 7 machine, but I cannot format it from its native disk managment utility (the format option is greyed out). What can stop me from throwing it in the trash?

pan64 11-06-2013 07:32 AM

you should umount before fsck. you can also try fdisk.

colucix 11-06-2013 07:35 AM

Quote:

Originally Posted by pan64 (Post 5059347)
you should umount before fsck. you can also try fdisk.

I assure you I did umount it before trying various commands, fdisk included. It always complains the system is read-only.

rtmistler 11-06-2013 07:36 AM

I'm assuming you've tried to wipe the partition table, make it something totally different; like ext2 and then create a new file system for it? What does fdisk get you?

rtmistler 11-06-2013 07:39 AM

Quote:

Originally Posted by colucix (Post 5059351)
fdisk included. It always complains the system is read-only.

2Gig thumbstick? You're not trying to save any data? I say chuck it! Or slice it up with a power tool just to vent.

colucix 11-06-2013 07:44 AM

Code:

# fdisk /dev/sdb
You will not be able to write the partition table.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
        switch off the mode (command 'c') and change display units to
        sectors (command 'u').


Command (m for help): d
Selected partition 1

Command (m for help): w

Unable to write /dev/sdb

fdisk -l reports the following:
Code:

Disk /dev/sdb: 2001 MB, 2001076224 bytes
62 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 3844 * 512 = 1968128 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x79f3dc19

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *          1        1016    1952721    6  FAT16


pan64 11-06-2013 07:49 AM

probably: http://www.tomshardware.co.uk/forum/...otection-drive

colucix 11-06-2013 07:49 AM

Quote:

Originally Posted by rtmistler (Post 5059353)
2Gig thumbstick? You're not trying to save any data? I say chuck it! Or slice it up with a power tool just to vent.

I saved what could be saved. I just wanted to avoid buying a new one, if by chance it can be restored. I'm going to throw it in the basket at this point! ;)

rtmistler 11-06-2013 07:53 AM

If it's really important to you, there's always grab the source for fdisk and remove the checks which dis-allow writing of the partition table.

I took a look and the version I found did not have that particular error verbiage in it, fdisk.c.

Another option is to boot to single user mode in command line so that when you plug in that thumbstick, it never gets attempted to be mounted, but I'm guessing that you've already done that. My thinking there is that it won't have tried to do anything with it and the system might consider it to be a fresh disk which once you do fdisk and just say re-partition. I think you're already past that though.

colucix 11-06-2013 08:00 AM

Quote:

Originally Posted by pan64 (Post 5059358)

I've tried this method, but the message is always the same:
Code:

Cannot format. This volume is write protected.

colucix 11-06-2013 08:06 AM

Quote:

Originally Posted by rtmistler (Post 5059364)
Another option is to boot to single user mode in command line so that when you plug in that thumbstick, it never gets attempted to be mounted, but I'm guessing that you've already done that. My thinking there is that it won't have tried to do anything with it and the system might consider it to be a fresh disk which once you do fdisk and just say re-partition. I think you're already past that though.

Yes, I tried. It doesn't mount but fdisk behaves as in runlevel 5:
Code:

Unable to write /dev/sdb
Now I will try to compile fdisk with that checking removed, just for the sake of curiosity.

Edit: I've just tried to compile fdisk, but I cannot find the part of code containing the error message. I give up now! Thank you for the support.

pan64 11-06-2013 09:15 AM

Just because I'm interested how it can happen: http://superuser.com/questions/40268...w-can-i-fix-it (probably you have seen it already).

rtmistler 11-06-2013 09:19 AM

Quote:

Originally Posted by pan64 (Post 5059425)
Just because I'm interested how it can happen: http://superuser.com/questions/40268...w-can-i-fix-it (probably you have seen it already).

You gotta be kidding me! They put a bleeping SD Micro inside their USB flash drive? I've never torn one apart, but really didn't expect to see THAT. Laughing, but ... it works, eh?

lleb 11-06-2013 11:19 AM

http://sosfakeflash.wordpress.com/20...-flash-drives/

man that is really disgusting that companies would do such horrid bait and switch tactics and still be able to get away with it.

mdlinuxwolf 11-08-2013 11:06 AM

Try running as root and mount it then. Click on the drive's properties and change its permissions to read/write using either a terminal or one of the many graphical tools. Be sure to make these changes applicable to all files and subfolders in all directories.

If you can still read what's on there, you should be able to copy and paste all data to another hard drive or file system. Then use it normally. Running as root makes this process easier, one reason to not disable the root's account gui. Just use a really strong password and take it offline whenever possible.


All times are GMT -5. The time now is 11:12 PM.