Context

Can any of you help me with the following, I've got a micro sd card inserted via a usb stick into my Compaq 8510w laptop running the latest Arch Linux (x86_64) release. I have a udev rule that automounts the drive upon insert like this:

KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"

# Get label
PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# use basename to correctly handle labels such as ../mnt/foo
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
ENV{dir_name}=="", ENV{dir_name}="usbhd-%k"

ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su bas -c '/usr/bin/pmount %N %E{dir_name}'"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su bas -c '/usr/bin/pumount /media/%E{dir_name}'"
LABEL="media_by_label_auto_mount_end"KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
LABEL="media_by_label_auto_mount_end"

A verbatim copy of this ArchWiki page, when the usb stick is inserted it gets mounted as reported by mount like so:

/dev/sdb1 on /media/usbhd-sdb1 type vfat (rw,noexec,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,fmask=0177,dmask=0077,iocharset=iso8859-1)

Read access is fine but when I try to cp a few files to the drive cp reports

cp: cannot create regular file `/media/usbhd-sdb1/R4iMenu/system.fon': Read-only file system

Things I tried

  • reboot
  • mount -o rw
  • searching the global interweb
  • copying the output of mount to /etc/fstab and fixing the syntax, mount /dev/sdb1

Any suggestions would be greatly appreciated.

Thanks.


Update

dmesg |tail -15 output after inserting the usb drive:

usb 2-5: new high speed USB device using ehci_hcd and address 4
Initializing USB Mass Storage driver...
scsi5 : usb-storage 2-5:1.0
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
scsi 5:0:0:0: Direct-Access     ChipsBnk SD/MMCReader     4081 PQ: 0 ANSI: 2
sd 5:0:0:0: Attached scsi generic sg2 type 0
sd 5:0:0:0: [sdb] 7954432 512-byte logical blocks: (4.07 GB/3.79 GiB)
sd 5:0:0:0: [sdb] Write Protect is off
sd 5:0:0:0: [sdb] Mode Sense: 0b 00 00 08
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sd 5:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sd 5:0:0:0: [sdb] Attached SCSI removable disk

Running fsck.vfat

fsck reports a lot of issues esp. a large number of Bad filename and Start cluster beyond limits .. errors. After completion of fsck the file system can be written to. So my original problem is solved.

Follow up question

Is there any log file that reports the fall back to ro mode in case of a corrupt file system, such that I can more easily detect the issue in the future?

link|improve this question
is the FAT file system corrupted? What is the output of your dmesg? Can you unplug the USB stick, and then plug it back in and send us the output of dmesg | tail -20 to see how USB is handling the stick. – Jonathan Aug 2 '10 at 10:56
@Jonathan: file system is ok according to Windows XP SP3 32bit (it reads and writes it without problems), will generate dmesg tail and update question later today (don't have access to the machine @work). – Bas Bossink Aug 2 '10 at 11:05
2  
Sounds like a corrupted filesystem to me, even if WXPSP332b is able to access it. Linux tends to throw in the towel and remount vfat filesystems as read-only if it suspects something is rotten. Running scandisk on Windows or fsck.vfat on Linux (be careful!) might make writing to work. – Janne Pikkarainen Aug 2 '10 at 11:15
I have noticed that Windows' own implementation of FAT is far more lenient when it comes to faulty drives than the Linux VFAT implementation. I have had many drives show up on Windows that do not show up in Linux at all, and the dmesg output always shows that drives are subsequently mounted read-only due to faults. – Jonathan Aug 2 '10 at 11:17
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.