Fstab Boot automatically mount disk information detailed

Source: Internet
Author: User

Df-h displaying disk information in a human-readable manner

[Email protected] etc]# df-h

File system capacity has been used with available% mount points

/dev/mapper/volgroup00-root 64G 17G 44G 28%/

Devtmpfs 3.5G 0 3.5G 0%/dev

Tmpfs 3.5G 0 3.5G 0%/dev/shm

Tmpfs 3.5G 82M 3.4G 3%/run

Tmpfs 3.5G 0 3.5G 0%/sys/fs/cgroup

/DEV/SDA1 477M 97M 351M 22%/boot

/dev/mapper/volgroup00-home 9.8G 37M 9.2G 1%/Home

/dev/mapper/volgroup00-data 148G 7.4G 133G 6%/data

Tmpfs 704M 0 704M 0%/run/user/0

Tmpfs 704M 0 704M 0%/run/user/1000


/etc/fstab file

Contains 6 columns

First column: The device disk partition to be mounted

Second column: mount point, on which directory to mount

Third column: File system, common File system EXT2,EXT3,XFS,TMPFS (temporary file system), Proc (virtual file system), ReiserFS (Understanding, small file system, high efficiency) default EXT4

Fourth column: Mount option options (most useful settings),-O noatime (do not change timestamp, improve performance), noexec (Do not execute, do not execute file under the partition). It enables the mounted device to load automatically when booting, the Chinese display does not appear garbled, restricts the read, write, and execute permissions on the mounted partition.

Recommended Parameters:

Noatime, turning off the atime feature, improves performance, which is an old feature that can be safely turned off and also reduces loadcycle

Defaults: The default setting is equal to Rw,suid,dev,exec,auto,nouser,async, and the specific meaning is explained below.

Executable:

EXEC is a default setting that enables executable binaries in that partition to execute. noexec binary files are not allowed to execute. Never take this option in your root partition!!!

User Mount Permissions:

User allows any users to mount the device.   implies Noexec,nosuid,nodev unless overridden. Nouser only allows root users to mount. This is the default setting.

Read and Write permissions:

Umask= this is about read and write permissions, it seems to be more effective than the following RO,RW options!!! For example: umask=000 or 0222, so that when Mount option has default, the ordinary user can still read and write the contents of the mounted device RO mount as read-only permission RW mount as read-write permission

Automatic and manual mounting:

Auto Mount Noauto Device (partition) can only manually mount the file system can mounted only explicitly when starting or entering mount-a in the terminal.


Fifth column: Do not back up, 0 not backup, 1 backup. Generally do not need to backup, think Backup can.

Sixth column: To scan the disk without booting, 0 does not scan, 1 and 2 scans. General system comes with partition/and/boot scan, if there is bad auto scan and fix.

[Email protected] etc]# Cat/etc/fstab

#/etc/fstab

# Created by Anaconda on Mon Jan 11 04:14:34 2016

#Accessible filesystems, by reference, is maintained under '/dev/disk '

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

/DEV/MAPPER/VOLGROUP00-ROOT/EXT4 Defaults 1 1

Uuid=a3a15e44-be58-4248-a74f-fdd613a353d3/boot EXT4 Defaults 1 2

/dev/mapper/volgroup00-data/data EXT4 Defaults 1 2

/dev/mapper/volgroup00-home/home EXT4 Defaults 1 2

/dev/mapper/volgroup00-swap swap swap defaults 0 0


Vim/etc/fstab after adding a new mount

/dev/sdb1/mnt ext4 Default 0 0

Mount-a make the configuration file effective, permanent, boot automatically mount



Similar:mount-t ext4-o default/dev/sbd1/mnt

Or: Mount-t ext4-o noatime,noexec/dev/sdb1/mnt

Umount/mnt Uninstall, cancel mount

Immediate effect, restart after the failure, need to re-mount.



Create a virtual block device (partition)

DD If=/dev/zero of=/opt/sdb1 bs=4096 count=100

By/dev/zero, this special device generates/DEV/SDB1 devices, block size 4096, and how many block=100 are required


MKFS.EXT4/OPT/SDB1 Formatting partitions

Mount-t Ext4-o default/opt/sdb1/mnt Mount

Df-h to see if the mount is mounted


Fstab can mount devices, UUID, and tags.


FSCK detects the disk (preferably a disk that is not detected) and detects only the disks that have been unloaded.


/etc/fstab Disk mount file What if the mount error causes the server to fail to start?

Repair:

1) Open the opportunity prompt, enter the password, select Repair.

2) Enter rescue mode, rescue. Possible rescue mode for root directory transformation.

After entering rescue mode, the/etc/fstab file is read-only and cannot be modified. Can only be used Mount-o Rw,remount/




Also able to boot automatically mount:

Vim/etc/rc.local

..

Mount-t Ext4-o loop,noatime,noexec/opt/sdb1/mnt


Fstab Boot automatically mount disk information detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.