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
rebootmount -o rw- searching the global interweb
- copying the output of
mountto/etc/fstaband 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?