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

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

我的存储设备(实际上是充当像 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/日志/消息:

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

答案1

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

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

答案2

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

sudo fsck.msdos -aw /dev/sdb1

对我有用。

答案3

要求 Windows 修复设备上的文件系统并正确弹出它。

答案4

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

1)通过以下方式找到 USB 驱动器目录df -Th

umount2)通过命令卸载USB驱动器

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

4) 之后,您可以从系统中移除 USB 笔式驱动器并将其重新连接到系统。现在,您的 USB 笔式驱动器应该是可写入的。

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

相关内容