/etc/fstab 是 mount 的設定檔。開機過程中,1 號 process 會執行 inittab 的 sysinit 動作,可能有個動作就是 mount -a,會照 /etc/fstab 自動掛載所有需要的目錄。最後所有實際掛載狀況紀錄在 /proc/mounts (或 /etc/mtab)。
/etc/fstab 每行有 6 個欄位:device、dir、type、option、dump、pass。
- device (儲存裝置):裝置路徑、UUID= 或 LABLE=,虛擬檔案系統用 none。如 /dev/sda1。
- dir (掛載點)
- type (檔案系統類型):如:ext4, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swap。
- option (掛載參數):mount 的參數,不同檔案系類型會有不同的特殊選項可以使用。共通選項:
- auto / noauto - 開機時或執行 'mount -a' 時是否自動掛載。預設 auto。
- exec / noexec - 是否允許二進位執行檔執行。預設 exec。
- ro - 唯讀。
- rw - 可讀寫。
- sync - synchronous I/O
- async - asynchronous I/O
- user - 允許任何用戶掛載 (implies noexec,nosuid,nodev unless overridden.)
- nouser - 只允許 root 掛載 (default)
- defaults - 使用預設掛載設定 (相當於 rw,suid,dev,exec,auto,nouser,async).
- suid - Allow the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
- nosuid - Block the operation of suid, and sgid bits.
- noatime - 不更新 inode access time。可增進效能 (see atime options).
- nodiratime - 不更新 directory inode access time。可增進效能 (see atime options).
- relatime - Update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time. (Similar to noatime, but doesn't break mutt or other applications that need to know if a file has been read since the last time it was modified.) Can help performance (see atime options).
- dump:有 dump 工具程式時,用來決定何時備份。0 = 不備份、1 = 每日備份、2 = 隔日備份。
- pass:決定 fsck 檢查順序:0 = 不檢查、1 = 根目錄優先檢查、2 = 其它要檢查的目錄。
http://linux.vbird.org/linux_basic/0230filesystem.php#bootup
https://wiki.archlinux.org/index.php/Fstab_(正體中文)
https://www.opencli.com/linux/fstab
udev 和裝置熱插拔
沒有留言:
張貼留言