Fixing a read-only USB key (fat) in ubuntu 8.04

so, for some reason (most likely, because I pulled out my usb drive [older one, 256 MB] before unmounting or closing all the documents – doh!) All of the files on my usb key drive were now only read-only on my ubuntu 8.04 hardy install.

I panicked, briefly (my SIP, senior thesis was on here, and although I make backups, I hadn’t made one in 2 or 3 days).

First, I tried to change the permissions with chown: that didn’t work.

Then, I was recommended to use fsck, which is designed to repair the sectors of the disk.

sudo fsck /dev/sdb1 -t fat
fsck 1.40.8 (13-Mar-2008)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Contains a free cluster (108). Assuming EOF.
File size is 17388 bytes, cluster chain length is 0 bytes.
Truncating file to 0 bytes.
Reclaimed 1 unused cluster (16384 bytes).
Leaving file system unchanged.
/dev/sdb1: 3287 files, 13969/15656 clusters

Apparently, the above description is something that would look right when it was prepared in fsck, but the files were still read-only for me. (thanks to jrib and blueeagle in the ubuntu irc channel for all of their advice on this).

At this point, I opened up that .tex file and realized the latter end of the file was missing (which didn’t contain any new information) . This led me to believe the file itself was still corrupt.

In the end, I copied all of the files to my local hard drive, and then booted up in windows xp to format the USB key. The USB Drive now functions normally. Thankfully, I didn’t lose any valuable data.

Post a comment or leave a trackback: Trackback URL.


  • tomas powderly  On January 3, 2009 at 11:42 pm

    i just had same happen
    i found that Xandros saw a single truncated file on an 8G thunb, and marked the whole partition/mount read only
    but didnt bother to tell me, it said there was many other possibilities which are wild goose chases

    and same thumb on Ubuntu was fine, tho i could see the file was suddenly ended ( prefs.js for tbird)

    i also went to windows to format it

    old suggestion from the authors of the dostools… use the native system to format your harddrive
    (there were no usb thumbs in those days)
    and those were the authors of dosfsck
    hope that reduces the pain ;)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s