In linux, we often use the mount command to mount hard disk partitions or discs to the file system.
/Etc/fstab is the file system automatically mounted to linux during boot.
In linux, the data items of/etc/fstab are as follows:
/Dev/device mountpoint type rules 0 order
For example, this is a common/etc/fstab:
/Dev/hda2/ext3 defaults 0 1
/Dev/hda3 swap defaults 0 0
/Dev/hda5/usr ext3 defaults 0 0
/Dev/fdo/mnt/flopy ext3 noauto 0 0
/Dev/cdrom/mnt/cdrom iso9660 noauto, ro 0 0
/Dev/device is the device to be mounted, And/hda2 is the second partition of the primary hard disk on the first IDE slot. If it is the third partition of the primary hard disk of the second IDE slot, It is/dev/hdc3. You can use fdisk-l in linux to view details.
Mountpoint is the mount point. //,/Usr, and swap are default mount points in the system installation time zone.
If you want to mount a new device, you should think about it, because the new device will be a permanent part of the file system, according to FSSTND (File System Standard) and its role, user needs. For example, if you want to use it as a shared resource, put it under/home is a good choice.
Type refers to the file system category.
Rules refers to the rules for mounting. Below are several common examples:
Auto mount
Default sets the Mount definition according to the default values of most permanent file systems.
Noauto is not automatically mounted upon startup
Nouser can be mounted only by Super Users.
Ro mounting by read-only permission
Rw mount by read/write permission
User any user can mount
Note that the optical drive and soft drive can be mounted only when the media is installed, so it is noauto
0 refers to dump (system backup tool ). If this parameter is set to 0, no backup is performed. If the last dump backup was used, the number of days since the backup is displayed.
Order refers to the order in which fsck checks are performed at startup ). If the value is 0, no check is performed. (/) partitions are always
Yes 1. Other partitions can only start with 2. When the numbers are the same, check at the same time (but there cannot be two 1 ).
If I want to mount windows C on the primary hard drive of the second IDE slot to the file system, the data items are:
/Dev/hdc1/c vfat defaults 0 0
(/C is a pre-created folder, which serves as the mount point of drive c .)
After you modify/etc/fstab, you must reboot the system to make it effective.
Fstab stores important information related to partitions. Each row is a partition record, and each row can be divided into six parts, the following uses/dev/hda7/ext2 defaults 1 as an example to describe one by one:
1. The first is the physical location of the storage device you want to mount, such as hdb or/dev/hda7 in the above example.
2. The second item is the directory to which you want to add it, such as/home or/in the above example. This is the Mount point prompted during installation.
3. the third item is the so-called local filesystem, which contains the following formats: ext, ext2, msdos, iso9660, nfs, swap, etc., or ext2, for more information, see/prco/filesystems.
4. the fourth item is the status you want to set when you mount, such as ro (read-only) or the above example of ults (including other parameters such as rw, suid, exec, auto, nouser, and async), you can refer to "mount nfs 」.
5. The fifth item is to provide the DUMP function. It indicates whether the BACKUP flag is required during system DUMP. The value is 0.
6. The sixth item is to set whether the filesystem performs the check action at startup. Except for the root filesystem, the required check value is 1. The other items can be set as needed. The internal value is 0.