Linux中fstab檔案的配置和理解

來源:互聯網
上載者:User

fstab(/etc/fstab)是Linux下比較重要的設定檔,它包含了系統在啟動時掛載檔案系統和存放裝置的詳細資料。下面是我機子上的fstab檔案:

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot1            /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda11        swap                    swap    defaults        0 0
/dev/sda6               /mnt/winE               vfat    defaults        0 0
/dev/sda8               /mnt/winG               ntfs    defaults        0 0

可以看到這個檔案有六列,下面以最後一列為例一一作解釋,這裡假設你對mount命令比較熟悉:
1.    第1列是需要掛載的檔案系統或存放裝置,這裡為我Windows上的G盤,分區為/dev/sda8.
2.    第2列是掛載點,我選擇為/mnt/winG.
3.    第3列指定檔案系統或分區的類型,我的G盤是NTFS類型的,在Linux下表示為ntfs.

   File types:

   Linux file systems
: ext2, ext3, jfs, reiserfs, reiser4, xfs, swap.
   Windows:

    vfat = FAT 32, FAT 16
    ntfs= NTFS
   Note:
For NTFS rw ntfs-3g
   CD/DVD/iso:
iso9660
   Network file systems:

   nfs:
server:/shared_directory /mnt/nfs nfs <options> 0 0
   smb:
//win_box/shared_folder /mnt/samba smbfs rw,credentials=/home/user_name/winbox-credentials.txt 0 0
   auto:
The file system type (ext3, iso9660, etc) it detected automatically.
Usually works. Used for removable devices (CD/DVD, Floppy drives, or
USB/Flash drives) as the file system may vary on these devices.

4.    第4列為掛載選項,詳細參考man mount. 下面列出一些常用的選項:
   auto: 系統自動掛載,fstab預設就是這個選項
   ro: read-only
   rw: read-write
   defaults: rw, suid, dev, exec, auto, nouser, and async.

5.    第5列為dump選項,設定是否讓備份程式dump備份檔案系統,0為忽略,1為備份。
6.    第6列為fsck選項,告訴fsck程式以什麼順序檢查檔案系統,0為忽略。

參考資料:

“How to edit and understand /etc/fstab”:

http://www.tuxfiles.org/linuxhelp/fstab.html

"How to fstab":

http://ubuntuforums.org/showthread.php?t=283131

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.