Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|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

1 Answer 1

This happened to mewhile using a USB SD card reader.

I created a kubuntu install stick with Universal USB Installer 1.9.2.1 all went well Win 8 When I went to add more files Ubuntu 12.10 to my 8 gig class 10 sd card it came up read only. Went back to Win 8 same thing read only. Looked for regedit lines from on solution my reg had no entry.

Checked my lock switch and moved it from the position it was allways in to the other position and TADA. Added files went to Ubuntu 12.10 and added files.

Here is where it gets stranger. I decide to install Kubuntu 12.4.1 so I go to format drive to recreate a install stick with Kubuntu 12.4.1. I try Universal USB Installer 1.9.2.1 with erase disk checked. No go read only again. Try to format Win 8 and no go. Try to format gpart no go. Back to Win 8 change advanced sharing and add my user and select full access for it and the everyone user. Try to format and TADA ! It wipes and I create a Kubuntu 12.4.1 install stick. I install Kubuntu and decide I need a few more files from Win 7 Laptop and no go READ ONLY ! Try everything above again and no go.

I removed the SD card and plugged it in the Win 7 Laptop card reader slot and it was a normal working normal and has ever since. If I put it in the USB unit it still comes up Read only.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.