USB flash drive changes to read-only on the fly
andrew clarke
mail at ozzmosis.com
Wed Sep 22 21:51:58 UTC 2010
On Wed 2010-09-22 22:21:27 UTC+0200, Daniel Louw (daniel at dline.co.za) wrote:
> This might be a silly question, but it is very frustrating.
>
> I have this memory stick, a 2 GB one formatted with FAT32.
>
> I was working on a .C file stored on the memory stick, saving as I
> made progress with the code. Then all of a sudden I cannot save
> anymore. I get an error saying the disk is read only. I cannot create
> new folders or files or anything. chmod doesn't work, it simply says
> read only partition. What the hell?
>
> Could it be because I compile directly on the disk? I use the disk a
> lot at university and it is much easier to just work directly on the
> disk.
Not a silly question.
Compiling directly on the memory stick is no different to writing any
other type of file to the disk. As far as Linux is concerned it's
just another drive.
I suspect there is some sort of FAT32 filesystem corruption on the
memory stick, and once the Linux kernel encounters it it switches its
FAT32 driver to read-only as to not cause any further corruption. You
can do a file system check/repair on the memory stick from the Ubuntu
GUI - System -> Administration -> Disk Utility. Then select the
memory stick's FAT32 partition and click Check Filesystem. You may
need to click on Unmount Volume first.
On the other hand you may have encountered a bug in the FAT32
driver, although given the number of years people have been using
FAT32 in Linux this is pretty unlikely. :-)
/var/log/messages may give you some clues. You can view it from the
Ubuntu GUI - under System -> Administration -> Log file viewer.
FAT32 is pretty fragile. Instead of doing the FAT32 filesystem check
above you may just want to make a backup of your data on the memory
stick, reformat it as NTFS and copy the data back. NTFS is a bit more
robust, with errors in the filesystem generally handled a lot more
gracefully.
There are few reasons not to use NTFS on memory sticks these days. For
example the NTFS driver in Apple Mac OS X is read-only but you can
download/install software to allow read/write NTFS drives on OS X.
Similarly FreeBSD and other lesser-known operating systems.
Regards
Andrew
More information about the ubuntu-users
mailing list