Linux Disk Management four--(3) Mount mount,/etc/fstab configuration file

Source: Internet
Author: User
Tags uuid

When we are finished, and the file system is formatted, the last mount Mount is mounted and the disk device is ready to use.

One, what is Mount, uninstall

Any block device cannot be accessed directly, and must be mounted on the directory to access

Mount : An association between an additional file system and an existing directory of the root filesystem, which makes this directory an entry for other files (the mounted device must have a file system)

Uninstall : The process for removing this association relationship

Mount [-Options] device (equipment) mount_point(mount point)

(1) device : Indicates which devices to Mount

① device files: For example /dev/sda5

② label :-L ' LABEL ', such as- l mage

③uuid,-u ' UUID '

(2) The existing file under mount point will be temporarily hidden after the mount is completed

It is recommended to use an empty directory. the device that the process is in use cannot be uninstalled

(3)/etc/mtab: File shows all devices currently mounted (in CentOS 7 , is /proc/mounts Soft Connect, see results likeCentOS 6 ,ASCII text, query results and /proc/ Mounts not the same)

Two,Mount : Mount common Command Options (there are specific usage examples below)

View mounts:findmnt View all device mounts (tree-like display)

FINDMNT Devices View the mount of a single device

Mount: View all device mounts

Cat/proc/mounts: View All mounted devices tracked by the kernel

Mount-Option Device mount point

-T:vsftype : Specifies the type of file system on the device to be mounted (not commonly used, no - t defaults to bring its own file system type), sometimes, system error prompt, no file system type specified ,-t is specified and is still wrong. (Note 1)

- R :readonly , read-only mount, no other operations, and permissions independent, media can only read, more for cold backup. show ro at Mount query

-W:Read and write, read-write mount (defaults default)

- NHidden mount information is not displayed , but can be found in/proc/mounts, uninstall can only umount/app/sdb2(mount point)

-A : Automatically mount the/etc/fstab file without a mounted device ( defined in the /etc/fstab file, and the Mount option has Auto function, which is included by default , does not look at the device that has been mounted, if the device that is mounted in /etc/fstab modifies the setting, does not refresh;

Mount-o REMOUNT/DEV/SDX(mount point) if you want to refresh a mounted device that has been modified

- L ' LABEL ': Specify mount device with volume label

- u ' UUID ': Specifies the device to be mounted with the UUID

- b --bind: Bind directory to another directory,

Example: mount-b/var/ftp/pub/app/apache/app/apache is something that shows the /var/ftp/pub directory

- o options:( option to mount file system ) , multiple options separated by commas

Async(defaults),sync Asynchronous, Sync, memory change, write disk simultaneously (can be used for important data)

Atime (defaults), Noatime is updated on Read access atime

Diratime (defaults), Nodiratime Directory Access timestamp

Auto (defaults)/noauto the partition written in /etc/fstab , whether it is mounted at mount-a

EXEC (defatuls)/noexec whether the script in the directory that is mounted on the partition can be executed.

Dev (defaults)/nodev: Whether to support the use of device files on this file system

Suid (defaults)/nosuid: suid and sgid permissions supported

ro : Read-only RW: Read/write (defaults)

Nouser (defaults)/user: Whether a normal user is allowed to mount this device, the default administrator can mount

ACL(centos 7)/^acl(CentOS 6 or less): Enabled / Disable the ACL feature on this file system

Defaults default, see above (defaults)

-o remount, options : Re-mount, modify feature options (and /etc/fstab option Conflict, overwrite, no conflict increase) example:mount-o remount,ro/dev/sdb1

Example: Mount-r/dev/sdb1/app/sdb1 Mount/DEV/SDB1 read-only to/app/sdb

third,umount unloading

Uninstall, if you have an ongoing process, you cannot uninstall

To view the process that is accessing the specified file system:

lsof devices or mount points can be

fuser-v mount point

Terminates all processes that are accessing the specified file system:

fuser-km devices or mount points can be

All processes can be uninstalled after terminating : umount DEVICE

iv./etc/fstab file mount configuration file

(1)/etc/fstab each row defines a file system to mount

Mount-a automatically mount a /etc/fstab file without a mounted device, regardless of the mounted device

Mount-o REMOUNT/DEV/SDX(or mount point) if you want to refresh a mounted device that has been modified

Swpon-a Auto-activated /etc/fstab file does not have an active swap (expansion) space, regardless of the activated expansion space

Mount-o REMOUNT/DEV/SDX(or mount point) if you want to refresh a modified extended device that has been activated

When the system restarts, the file is read from the machine, and the settings in the file can be turned on automatically.

(2) format (6 columns):

① device or pseudo file system to mount: device name,LABEL,UUID, pseudo file system name

② mount point (extended to swap)

③ File system type (auto looking for default),

Normal device mount:ext#/xfs and other file system types

swap partition swap:swap

Network mount address between Linux :NFS,windos mount:cifs

disc iso9660, file cifs

④ mount option:defaults required function can be added, cannot be empty

⑤ Dump frequency: 0: Do not do backup 1: Dump every day 2: Dump every other day

⑥ self-Test at boot time (not 0), self-test sequence: (If the boot system self-test, it will not boot properly)

0: Not self-test 1: The first self-test, generally /2 ... : Number smaller priority Max

Question: What should I do if the device is accidentally damaged and post is not enabled?

The principle is very simple, only need to repair the file system is good, (if not repair, you can go to the/etc/fstab to change the self-test to 0) specific operation as follows:

① Manual Sabotage device dd if=/dev/zero of=/dev/sdc1 bs=1 count=2048

② boot process, encountered error prompt

③ into the shell operation for repair

V. Experiment: Migrate/home Directory

so we've got a pretty close look at Disk Management, and we can do a little experiment, Migrate /home , move from / down to another disk, such as /dev/sda6

①init 1 enters single-user mode to prevent other users from operating while migrating, resulting in missing things after migration.

② partition /dev/sda6 fdisk

③ File System format Mkfs.ext4/dev/sda6

④ mount in the temporary directory /mnt , cp-a to /mnt . Catalogue

⑤ the existing home/home things removed, uninstall /mnt , put /dev/sda6 to /Home down, and write /etc/fstab, Boot automatically mount.

Uuid=328a3f17-3e4e-426d-9538-c44be3e6465b/home EXT4 Defaults 0 2

⑥reboot or init 5 complete /home Relocation

The process of disk Management is over, and the next one complements some of the extended space, external devices, and gadgets.

I hope to help you, what's wrong please tell me ~

Linux Disk Management four--(3) Mount mount,/etc/fstab configuration file

Related Article

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.