s1c*_*s1c 31 linux filesystems readonly
不知何故,我的 Debian 只能在根文件系统中读取。我不知道这是怎么发生的。
例如,当我在/root
文件夹中并键入命令nano
,然后按下Tab以列出该文件夹中可能的文件时,我收到消息:
root@debian:~# nano -bash: cannot create temp file for here-document: Read-only file system
Run Code Online (Sandbox Code Playgroud)
cd
当我键入cd /home
并按下Tab以列出路径时,命令也是如此:
root@debian:~# cd /home -bash: cannot create temp file for here-document: Read-only file system
Run Code Online (Sandbox Code Playgroud)
我也有类似apt
和其他软件的问题。甚至无法 apt-get 更新。我有很多这样的错误:
Err http ://ftp.de.debian.org wheezy-updates/main Sources
406 Not Acceptable
W: Not using locking for read only lock file /var/lib/apt/lists/lock
W: Failed to fetch http ://ftp.de.debian.org/debian/dists/wheezy/Release rename failed, Read-only file system (/var/lib/apt/lists/ftp.de.debian.org_debian_dists_wheezy_Release -> /var/lib/apt/lists/ftp.de.debian.org_debian_dists_wheezy_Release).
W: Failed to fetch http ://security.debian.org/dists/wheezy/updates/main/source/Sources 404 Not Found
W: Failed to fetch http ://security.debian.org/dists/wheezy/updates/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http ://ftp.de.debian.org/debian/dists/wheezy-updates/main/source/Sources 406 Not Acceptable
E: Some index files failed to download. They have been ignored, or old ones used instead.
W: Not using locking for read only lock file /var/lib/dpkg/lock
Run Code Online (Sandbox Code Playgroud)
我在系统中有很多问题。有没有可能解决这个问题?我如何检查发生了什么?我应该在日志中查找什么?
我知道这可能是因为/etc/fstab
文件中的一行:
/dev/mapper/debian-root / ext4 errors=remount-ro 0 1
Run Code Online (Sandbox Code Playgroud)
但问题是什么?我什么也找不到,或者我不知道去哪里找。
编辑:
我确实搜索了消息日志,发现只有这个:
kernel: [ 5.709326] EXT4-fs (dm-0): re-mounted. Opts: (null)
kernel: [ 5.977131] EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro
kernel: [ 7.174856] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: (null)
Run Code Online (Sandbox Code Playgroud)
我想这是正确的,因为我在其他 debian 机器上有相同的条目。
我在 dmesg 中找到了一些东西(我削减了一点输出,因为有很多标准的 ext4 东西)
root@gs3-svn:/# dmesg |grep ext4
EXT4-fs error (device dm-0) in ext4_reserve_inode_write:4507: Journal has aborted
EXT4-fs error (device dm-0) in ext4_reserve_inode_write:4507: Journal has aborted
EXT4-fs error (device dm-0) in ext4_dirty_inode:4634: Journal has aborted
EXT4-fs error (device dm-0): ext4_discard_preallocations:3894: comm rsyslogd: Error loading buddy information for 1
EXT4-fs warning (device dm-0): ext4_end_bio:250: I/O error -5 writing to inode 133130 (offset 132726784 size 8192 starting block 159380)
EXT4-fs error (device dm-0): ext4_journal_start_sb:327: Detected aborted journal
Run Code Online (Sandbox Code Playgroud)
5 个错误和 1 个警告。有任何想法吗?使用 mount -o remount,rw / 是否安全?
HBr*_*ijn 35
大多数 Linux 文件系统的默认行为是保护您的数据。当内核检测到存储子系统中的错误时,它将使文件系统只读以防止(进一步)数据损坏。
您可以使用errors={continue|remount-ro|panic}
系统手册中记录的挂载选项对此进行一些调整(man mount
)。
当您的根文件系统遇到此类错误时,大多数情况下该错误不会记录在您的日志文件中,因为它们现在也将是只读的。幸运的是,由于它是内核操作,因此原始错误消息首先记录在内存中,即内核环形缓冲区中。除非已经从内存中刷新,否则您可以使用以下命令显示环形缓冲区的内容dmesg
命令。.
大多数真正的硬盘都支持SMART,你可以使用smartctl
来尝试诊断磁盘健康状况。
根据错误消息,您可以决定使用文件系统仍然是安全的,并返回读写条件 mount -o remount,rw /
但总的来说,磁盘错误是磁盘完全故障的先兆。现在是创建数据备份或确认现有备份状态的时候了。