為什麼 Ubuntu/Linux /proc/mounts 對我說謊?

為什麼 Ubuntu/Linux /proc/mounts 對我說謊?

我的 rootfs 硬碟壞了 - 這可能導致檔案系統被掛載為唯讀......但/proc/mounts仍然說它已掛載rw

$ cat /proc/mounts 
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=7575440k,nr_inodes=1893860,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,relatime,size=3033888k,mode=755 0 0
/dev/disk/by-uuid/548b00b0-bd98-4017-9e62-5c27b633268b / ext4 ro,noatime,errors=remount-   ro,data=ordered 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
/dev/sdb1 /mnt/storage1 ext4 ro,noatime,errors=remount-ro,data=ordered 0 0
/dev/sdc1 /mnt/storage2 ext4 rw,noatime,errors=remount-ro,data=ordered 0 0
/dev/sdd1 /mnt/storage3 ext4 rw,noatime,errors=remount-ro,data=ordered 0 0

但是檔案系統是唯讀的:

$ touch new
touch: cannot touch `new': Read-only file system

這非常不幸,因為我使用的 Nagios/Icinga 腳本正是針對這一點check_ro_mounts進行檢查 。/proc/mounts它可以與安裝在其下的其他檔案系統一起使用,/mnt/沒有問題。

這是 Linux 核心的一些技巧嗎?我也不知道rootfs這裡的意思是什麼?

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.3 LTS
Release:    12.04
Codename:   precise
$ uname -a
Linux foo 3.5.0-25-generic #39~precise1-Ubuntu SMP Tue Feb 26 00:07:14 UTC 2013     x86_64 x86_64 x86_64 GNU/Linux

答案1

/in有多個條目/proc/mounts,第二個條目顯示有關您的真實根檔案系統的資訊(請注意ro那裡的標誌):

/dev/disk/by-uuid/548b00b0-bd98-4017-9e62-5c27b633268b / ext4 ro,noatime,errors=remount-ro,data=ordered 0 0

出現第一個具有rootfs檔案系統類型的條目是因為 Linux 核心在啟動期間內部創建了一個基於 RAM 的檔案系統,並解壓縮了該檔案系統。初始化檔案系統在那裡存檔;然後 initramfs 腳本和實用程式會載入所需的驅動程式模組並安裝真正的根檔案系統。

相關內容