Cấu hình /etc/fstab tự mount khi khởi động (Arch Linux)

Đây là file /etc/fstab của mình:
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
tmpfs /tmp tmpfs nodev,nosuid 0 0
# UUID=18f4379c-4862-4897-9645-5d24440b1429
/dev/sda3 / ext4 rw,relatime,data=ordered 0 1

# UUID=c6956948-4ca1-4bef-a777-1ac6d9e1f0ce
/dev/sda1 /boot ext4 rw,relatime,data=ordered 0 2

# UUID=0ea7ea96-3734-47fc-9304-6f2a34a19be4
none swap defaults 0 0
# <file system> <dir> <type> <options> <dump> <pass>
/dev/sda5 /home/archie/DATA ntfs-3g auto,noatime,user 0 0
/dev/sda6 /home/archie/MEDIA ntfs-3g auto,noatime,user 0 0

Trước tiên ta cần cài đặt gói ntfs-3g qua lênh: 
# pacman -Ss ntfs-3g

Để xem danh sách các partition trên ổ cứng:
[root@haidanghost archie]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8EDC5E5F-16C3-4B7E-A088-4EA094319215
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 74964432 sectors (35.7 GiB)

Number Start (sector) End (sector) Size Code Name
1 40 512039 250.0 MiB 8300 Linux filesystem
2 512040 2609191 1024.0 MiB 8200 Linux swap
3 2609192 104856324 48.8 GiB 8300 Linux filesystem
5 104856325 524297339 200.0 GiB 0700 Microsoft basic data
6 524297406 901808774 180.0 GiB 0700 Microsoft basic data

Còn đây là phần giải thích cấu trúc của file /etc/fstab (trích: https://wiki.archlinux.org/index.php/Fstab):
The /etc/fstab file contains the following fields separated by a space or tab:
<file system> <dir> <type> <options> <dump> <pass>


  • <file system> - the partition or storage device to be mounted.

  • <dir> - the mountpoint where <file system> is mounted to.

  • <type> - the file system type of the partition or storage device to be mounted. Many different file systems are supported: ext2, ext3, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swapand auto. The auto type lets the mount command guess what type of file system is used. This is useful for removable devices such as cdroms and dvds.

  • <options> - the options of the filesystem to be used. Note that some options are filesystem specific. Some of the most common options are:



  • auto - Mount automatically at boot, or when the command mount -a is issued.

  • noauto - Mount only when you tell it to.

  • exec - Allow execution of binaries on the filesystem.

  • noexec - Disallow execution of binaries on the filesystem.

  • ro - Mount the filesystem read-only.

  • rw - Mount the filesystem read-write.

  • user - Allow any user to mount the filesystem. This automatically implies noexec, nosuid, nodev, unless overridden.

  • users - Allow any user in the users group to mount the filesystem.

  • nouser - Allow only root to mount the filesystem.

  • owner - Allow the owner of device to mount.

  • sync - I/O should be done synchronously.

  • async - I/O should be done asynchronously.

  • dev - Interpret block special devices on the filesystem.

  • nodev - Don't interpret block special devices on the filesystem.

  • 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 - Don't update inode access times on the filesystem. Can help performance (see atime options).

  • nodiratime - Do not update directory inode access times on the filesystem. Can help performance (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).

  • flush - The vfat option to flush data more often, thus making copy dialogs or progress bars to stay up until all data is written.

  • defaults - the default mount options for the filesystem to be used. The default options for ext3 are: rw, suid, dev, exec, auto, nouser, async.



  • <dump> - used by the dump utility to decide when to make a backup. Dump checks the entry and uses the number to decide if a file system should be backed up. Possible entries are 0 and 1. If 0, dump will ignore the file system; if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the <dump> entry.


  • <pass> - used by fsck to decide which order filesystems are to be checked. Possible entries are 0, 1 and 2. The root file system should have the highest priority 1 - all other file systems you want to have checked should have a 2. File systems with a value 0 will not be checked by the fsck utility.

Post a Comment

Previous Post Next Post