如何从只读文件系统删除/编辑文件


12

我的存储设备(实际上是充当外部存储设备(如pendrive)的存储卡)出现问题。

Experimentx @ workmateX:/ var / www / zendtest $ sudo rm /media/A88F-8788/python-2.7.1-docs-html.zip
rm:无法删除`/media/A88F-8788/python-2.7.1-docs -html.zip':只读文件系统

我试图更改系统的文件许可权,但这不起作用

Experimentx @ workmateX:/ var / www / zendtest $ sudo chmod 0777 /media/A88F-8788/python-2.7.1-docs-html.zip
chmod:更改`/media/A88F-8788/python-2.7.1的权限-docs-html.zip':只读文件系统

但是它在Windows上完美地工作。

更新

在打开驱动器并运行命令时 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:

3月23日15:29:48 workmateX内核:[18042.257407] fat_get_cluster:抑制了11个回调Mar 23 15:31:40 workmateX内核:[18154.569747] fat_get_cluster:抑制了11个回调

Answers:


13

它以只读方式安装;您不能更改权限,只能尝试sudo mount -o remount,rw /media/A88F-8788。但是,如果运气像我的一样,那么您在插入卡时就设法抓住卡上的“锁定”滑块,必须将其弹出并更加小心地放入。

检查/var/log/messages并检查是否/var/log/syslog有挂载事件或可能的文件系统损坏(这可能导致内核以只读方式重新挂载它,以避免造成更大的损害)。


没用。我认为我没有滑到write-protector任何地方,因为它可以在Windows中使用。还有其他想法吗?
Santosh Linkha 2011年

您是否在我提到的日志文件中查看了是否报告了为什么它是只读的?
geekosaur 2011年

请检查更新
Santosh Linkha 2011年

@explorex:有问题,文件系统已损坏。尝试sudo umount /media/A88F-8788; sudo /sbin/fsck.msdos /dev/sdb1; sudo mount /dev/sdb1 /media/A88F-8788
geekosaur 2011年

那之后该怎么办?我将能够正确并正常工作吗?
Santosh Linkha 2011年

5

或者,如果您没有Windows,请使用以下命令在Ubuntu下修复文件系统:

sudo fsck.msdos -aw /dev/sdb1

为我工作。



2

这篇文章很有帮助:http : //sharadchhetri.com/2013/12/19/how-to-fix-read-only-usb-pen-drive-in-ubuntu/

1)找出USB随身碟目录 df -Th

2)通过umount命令卸载USB笔式驱动器

3)然后,运行dosfsck命令检查并修复文件系统

4)之后,您可以从系统中卸下USB笔式驱动器,然后将其重新连接回系统。现在,您的USB笔式驱动器应该是可写的。

更多详细信息:http : //sharadchhetri.com/2013/12/19/how-to-fix-read-only-usb-pen-drive-in-ubuntu/

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.