How to delete/edit files from readonly filesystem
Solution 1
It got mounted read-only; you can't change permissions, you can only try sudo mount -o remount,rw /media/A88F-8788
. But if your luck is anything like mine, you managed to catch the "Lock" slider on the card as you inserted it, and will have to pop it back out and put it in more carefully.
Check /var/log/messages
and /var/log/syslog
for mount events or possible filesystem corruption (which could cause the kernel to remount it read-only to avoid causing more damage).
Solution 2
Or if you don't have Windows, repair the filesystem under Ubuntu with:
sudo fsck.msdos -aw /dev/sdb1
Worked for me.
Solution 3
Ask Windows to repair the filesystem on the device and eject it properly.
Solution 4
This post is helpful: http://sharadchhetri.com/2013/12/19/how-to-fix-read-only-usb-pen-drive-in-ubuntu/
1) Find out the USB pen drive directory by df -Th
2) Unmount USB pen drive by umount
command
3) Then, run dosfsck
command to check and repair filesystem
4) After that, you can remove the USB pen drive from system and the re-attach it back to the system. Now, your USB pen drive should be writable.
More detail: http://sharadchhetri.com/2013/12/19/how-to-fix-read-only-usb-pen-drive-in-ubuntu/
Related videos on Youtube
Santosh Linkha
Updated on September 17, 2022Comments
-
Santosh Linkha over 1 year
I am having problem with my memory device (actually a memory card that act external memory device like pendrive).
experimentx@workmateX:/var/www/zendtest$ sudo rm /media/A88F-8788/python-2.7.1-docs-html.zip
rm: cannot remove `/media/A88F-8788/python-2.7.1-docs-html.zip': Read-only file systemI tried to change the file permission of the system but that doesn't work
experimentx@workmateX:/var/www/zendtest$ sudo chmod 0777 /media/A88F-8788/python-2.7.1-docs-html.zip
chmod: changing permissions of `/media/A88F-8788/python-2.7.1-docs-html.zip': Read-only file systemBut it perfectly works on windows.
UPDATE
On opening the drive and running command
sudo mount -o remount,rw /media/A88F-8788
/var/log/syslog:
Mar 23 15:29:48 workmateX kernel: [18042.257407] fat_get_cluster: 11 callbacks suppressed Mar 23 15:29:48 workmateX kernel: [18042.257414] FAT: Filesystem error (dev sdb1) Mar 23 15:29:48 workmateX kernel: [18042.257418] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:29:48 workmateX kernel: [18042.257425] FAT: Filesystem has been set read-only Mar 23 15:29:48 workmateX kernel: [18042.258187] FAT: Filesystem error (dev sdb1) Mar 23 15:29:48 workmateX kernel: [18042.258194] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.333787] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.333795] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.335949] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.335957] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.354903] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.354911] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.357213] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.357221] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.359547] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.359555] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.361929] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.361936] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.377416] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.377424] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.379384] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.379392] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.381898] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.381906] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:35 workmateX kernel: [18149.383764] FAT: Filesystem error (dev sdb1) Mar 23 15:31:35 workmateX kernel: [18149.383772] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.569747] fat_get_cluster: 11 callbacks suppressed Mar 23 15:31:40 workmateX kernel: [18154.569754] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.569758] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.569765] FAT: Filesystem has been set read-only Mar 23 15:31:40 workmateX kernel: [18154.572022] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.572029] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.582933] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.582941] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.585921] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.585929] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.587819] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.587827] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.597547] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.597555] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.599503] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.599511] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.602896] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.602905] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.615338] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.615346] fat_get_cluster: invalid cluster chain (i_pos 0) Mar 23 15:31:40 workmateX kernel: [18154.618574] FAT: Filesystem error (dev sdb1) Mar 23 15:31:40 workmateX kernel: [18154.618581] fat_get_cluster: invalid cluster chain (i_pos 0)
var/log/message:
Mar 23 15:29:48 workmateX kernel: [18042.257407] fat_get_cluster: 11 callbacks suppressed Mar 23 15:31:40 workmateX kernel: [18154.569747] fat_get_cluster: 11 callbacks suppressed
-
Santosh Linkha about 13 yearsdidn't work. i don't think i have slided
write-protector
anywhere, because it works in windows. Any other ideas? -
geekosaur about 13 yearsDid you look in the log files I mentioned to see if it reported why it was read only?
-
Santosh Linkha about 13 yearsplease check updates
-
geekosaur about 13 years@explorex: there's your problem, it's got a damaged filesystem. Try
sudo umount /media/A88F-8788; sudo /sbin/fsck.msdos /dev/sdb1; sudo mount /dev/sdb1 /media/A88F-8788
. -
Santosh Linkha about 13 yearsand what to do after that? will i be able to get it right and working?
-
geekosaur about 13 yearsHopefully. You could also do it from Windows, which will probably check and repair it when you insert it; just make sure you use the "remove safely" widget in the system tray instead of simply yanking it out.
-
Santosh Linkha about 13 yearssure .. i think that is the root of problems. I surely was ignorant. could you recommend any program to do that?