My memory card gets mounted read-only: how to fix?

Asked by Uqbar

I have no idea why, but my memory cards get mounted readonly:

/dev/mmcblk0 on /media/Nokia 2g 1 type vfat (ro,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)

So I cannot write on it.
How can I fix this situation?

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Uqbar
Solved:
Last query:
Last reply:
Revision history for this message
Bhavani Shankar (bhavi) said :
#1

Try

sudo mkdosfs -I /dev/sdb1 .... (or whatever is correct for your stick)
Remove the stick and plug it back in again.

and see

Revision history for this message
Uqbar (uqbar) said :
#2

The card used to work with KUbuntu 8.04 and is not working with Ubuntu 8.10.
So I would say the problem is somewhere else.
And the memory card has been formatted by the mobile phone, so re-formatting in a different way (no partition table) could yield to problems.

Revision history for this message
Uqbar (uqbar) said :
#3

No other hints there around?

Revision history for this message
Hemanth (hemanth-hm) said :
#4

*Try this :

*

*sudo chown -R <your username>:<your group> <device mount path>*

If failed , please see the o/p of below command , and mount FAT or NTFS FS
*
$ sudo fisk -l*

Check for size rather , it will be clear .

Say

sudo mount -t vfat /dev/sda1 /media/sda1

If it's FAT , or else say :

sudo mount -t ntfs-3g /dev/sdd1 /media/sdd1

--
'I am what I am because of who we all are'
http://www.ubunt2.blogspot.com
-- Hemanth HM

Revision history for this message
Uqbar (uqbar) said :
#5

auser@g1s:~$ sudo fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 2041 MB, 2041577472 bytes
4 heads, 16 sectors/track, 62304 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk identifier: 0x00000000

        Device Boot Start End Blocks Id System
auser@g1s:~$ ls -ld /media/Nokia\ 2g\ 1/
drwx------ 20 auser root 16384 1970-01-01 01:00 /media/Nokia 2g 1/
auser@g1s:~$ mount
...
/dev/mmcblk0 on /media/Nokia 2g 1 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
auser@g1s:~$

Whatever I try to do (but reading files) it's either unallowed or disabled (like "rename" menu item).
There something strange I had not noticed before.
After inserting the memory card in the reader I find these messages in the logs:

[12171.779273] mmc0: new SD card at address 0002
[12171.854241] mmcblk0: mmc0:0002 00000 1993728KiB (ro)
[12171.854351] mmcblk0:
[12173.367760] FAT: Filesystem panic (dev mmcblk0)
[12173.367774] invalid access to FAT (entry 0x0000f7fc)
[12173.368228] FAT: Filesystem panic (dev mmcblk0)
[12173.368238] fat_get_cluster: invalid cluster chain (i_pos 0)
[12173.368507] FAT: Filesystem panic (dev mmcblk0)
[12173.368516] invalid access to FAT (entry 0x0000f202)
[12207.783908] FAT: Filesystem panic (dev mmcblk0)
[12207.783923] fat_get_cluster: invalid cluster chain (i_pos 0)
[12207.784643] FAT: Filesystem panic (dev mmcblk0)
[12207.784649] fat_get_cluster: invalid cluster chain (i_pos 0)

I've browsed the card both on the cellphone using it and on the PC after insertion.
Now:
1. The card used to work under KUbuntu 8.04 (few weeks ago)
2. The card never gor re-partitioned/re-formatted after purchase
3. The card is working fine when used inside the cell phone

Revision history for this message
Uqbar (uqbar) said :
#6

If I manually umount and then mount the device (as root, of course) I get:

root@g1s:~# umount /dev/mmcblk0
root@g1s:~# mount /dev/mmcblk0 /mnt/
root@g1s:~# mount
...
/dev/mmcblk0 on /mnt type vfat (rw)
root@g1s:~# ls -ld /mnt
drwxr-xr-x 20 root root 16384 1970-01-01 01:00 /mnt

So I would say there's something wrong in the automount process.

Revision history for this message
Hemanth (hemanth-hm) said :
#7

Try these :

sudo mkdir /media/mmcblk0
sudo /dev/mmcblk0 /media/mmcblk0
 sudo ntfs-3g /dev/mmcblk0 /media/mmclk0

--
'I am what I am because of who we all are'
http://www.ubunt2.blogspot.com
-- Hemanth HM

Revision history for this message
Hemanth (hemanth-hm) said :
#8

Correction : mount as done before , not ntfs-3g

On Mon, Apr 6, 2009 at 4:46 PM, Hemanth H.M <email address hidden> wrote:

> Try these :
>
> sudo mkdir /media/mmcblk0
> sudo /dev/mmcblk0 /media/mmcblk0
> sudo ntfs-3g /dev/mmcblk0 /media/mmclk0
>
>
>
>
> --
> 'I am what I am because of who we all are'
> http://www.ubunt2.blogspot.com
> -- Hemanth HM
>

--
'I am what I am because of who we all are'
http://www.ubunt2.blogspot.com
-- Hemanth HM

Revision history for this message
Uqbar (uqbar) said :
#9

After a fair amount of work I've shot the trouble.
The memory card file system and partition table was corrupted.
In particular, the card used to have just a primary partition eating all the available room.
What was instead happening was that the partition table had (somehow) wiped out.
Some files and directories of the file system were corrupted (mangled names and I/O errors).
Nonetheless, the memory card was being mounted as if there were no partition and *almost* all file system was still accessible.
I did a backup copy of the content (only the interesting and readable parts) and then re-formatted it.
I am not sure whether such a condition can be checked during auto-mount and warned to the user.