LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can't write or delete from sd card (https://www.linuxquestions.org/questions/linux-newbie-8/cant-write-or-delete-from-sd-card-881761/)

sumeet inani 05-20-2011 04:28 AM

can't write or delete from sd card
 
Code:

mount
/dev/sdd1 on /media/E0FD-1813 type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush)
cp 'Aankhon Aankhon Mein hum tum ho gaye deewane.mp3' /media/E0FD-1813/Music/sumeet/a
cp: cannot create regular file `/media/E0FD-1813/Music/sumeet/a/Aankhon Aankhon Mein hum tum ho gaye deewane.mp3': Read-only file system

The micro sd card mounts & works as fat32 in windows xp just fine.

jschiwal 05-20-2011 06:03 AM

Look at the ownership and permissions of the mount point.
ls -ld /media/E0FD-1813

I'm wondering if the filesystem might be corrupt, or if you aren't the user with the UID of 1000.
The dmask only allows the owner to enter the directory. The fmask isn't listed.

sumeet inani 05-20-2011 09:48 AM

I was root.
I will try 'fsck.vfat -a /dev/sdd1'

Adol 05-20-2011 10:07 AM

I had this problem also. What I had to do is as root mount it to a user.

This may help: thanks to spazticclown
Quote:

You can also try mounting the USB drive using the command:
Code:

mount /dev/sdh1 /devices/usb -o uid=nnn

Where "nnn" is your uid (found with 'echo $UID' in console).

This should grant you permission to use the USB drive from that user.

Hope this helps in the short run.
The thread is here:I was having a problem that the device was root but the file was owned by a user. It wasnt letting me copy files over to a memory stick because of it.

Hope it helps

jschiwal 05-20-2011 06:16 PM

The pendrive was mounted as the user with the UID of 1000, which would be the first regular user.
Post the ls command results. The missing fmask mount option seems abnormal. Your regular user will be able to access the directories however according to the dmask used.

Try reading and writing to the disk as a regular user, as you should be doing.

sumeet inani 05-21-2011 08:06 AM

Code:

$ mount
/dev/sda5 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda8 on /sumeet type fuseblk (rw,allow_other,blksize=4096)
/dev/sdb1 on /media/SUMEET type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush)
/dev/sdc1 on /media/FreeAgent GoFlex Drive type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sdd1 on /media/E0FD-1813 type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush)
lxuser@debian:~$ cat > example.txt
copy the file into usb & mobile
lxuser@debian:~$ cp -v example.txt  /media/SUMEET/
`example.txt' -> `/media/SUMEET/example.txt'
lxuser@debian:~$ cp -v example.txt  /media/E0FD-1813/
`example.txt' -> `/media/E0FD-1813/example.txt'
cp: cannot create regular file `/media/E0FD-1813/example.txt': Read-only file system

lxuser@debian:~$ rm  /media/E0FD-1813/radio-001.mp3
rm:cannot remove 'radio-001.mp3' : read only file system

SUMEET is USB stick which poses no problem in copying.
while E0FD-1813 is SD card with same mount options yet immutable.

TobiSGD 05-21-2011 08:09 AM

Some SD-cards have a little switch to make the card read-only, you should have a look at that.

sumeet inani 05-21-2011 08:21 AM

The SD card is simply fitted in mobile slot.

TobiSGD 05-21-2011 09:56 AM

Quote:

Originally Posted by sumeet inani (Post 4362828)
The SD card is simply fitted in mobile slot.

And what about the switch?

sumeet inani 05-21-2011 03:20 PM

this is micro sd card of 2GB - a hard plastic piece.Also in mobile slot, it is merely pushed.No switch to turn , rotate or twist

MTK358 05-21-2011 03:25 PM

Quote:

Originally Posted by sumeet inani (Post 4363152)
this is micro sd card of 2GB - a hard plastic piece.Also in mobile slot, it is merely pushed.No switch to turn , rotate or twist

We're not talking about how to insert it into the reader. Forget about what you put the card into, see if there's a switch on the card itself.

Here's an image I found online: http://download.windowssecrets.com/i...nga-SDLock.jpg

sumeet inani 05-21-2011 11:19 PM

That image explains your point.
Nothing on card.
It is same as bottom one on http://upload.wikimedia.org/wikipedi...7/SD_Cards.svg

sumeet inani 05-21-2011 11:47 PM

'fsck.vfat -a /dev/sdd1' corrupted the file indexing by samsung OS of mobile by renaming files with non graphical characters.
The mobile manual had initially warned to format the micro SD card only with samsung OS
But I edited file system without heeding to that.
Yet 'read only file system error'.

jschiwal 05-22-2011 12:13 AM

Having graphical characters listed for the filenames indicates the either the filesystem is corrupt, or the SD card is going bad.

If fsck didn't fix the problem, you might need to use photorec to recover files on the filesystem before reformatting. If reformatting doesn't help, I'd say the device is going bad.

I had a similar problem yesterday with my kindle. I couldn't save items in Calibre with the same error message. Fsck fixed the problem for me. You may have had more extensive damage to the filesystem.

sumeet inani 05-23-2011 08:12 PM

Turns out the samsung OS in mobile creates file with non-ASCII names , maybe not adhering to FAT specification .
'fsck.vfat' was exhausted (1/2 hour up still working) in renaming those garbled folders.
Also 'find' indicated filesystem loop detected.
Those mobile OS software engineers cover up flaws with patch & label unintended bugs as security features.-Said by Dilbert
That is why they warned against formatting on computer instead mobile OS can do that.
Also it seems files on micro SD card get corrupted soon unlike USB stick.


All times are GMT -5. The time now is 08:39 PM.