Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set up automatic mounting for Linux

Shulou Source: shulou.com Published: 2022-06-01 20:09:13 09月26日 Update

This article introduces the relevant knowledge of "how to set up automatic mounting of Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Linux automatic mount specific method: 1. Modify / etc/fstab file to open the fstab file with vim, and you can see that the file format is as follows:

# # / etc/fstab # Created by anaconda on Tue Oct 20 11:50:19 2015 # # Accessible filesystems, by reference, are maintained under'/ dev/disk' # See man pages fstab (5), findfs (8) Mount (8) and/or blkid (8) for more info # / dev/mapper/vg_minimal-LogVol00 / ext4 defaults 11 UUID=f8066e4a-e1df-4815-9d6e-c74a6811ba5e / boot ext4 defaults 1 2 tmpfs / dev/shm tmpfs defaults 00 devpts / dev/pts devpts gid=5 Mode=620 0 sysfs / sys sysfs defaults 0 0 proc / proc proc defaults 0 0 can clearly see that the file has 6 columns.

The first column is the device name or volume label

Column 2 is the mount point (that is, the mount directory)

The third column is the file system or file system type of the device to be mounted

Column 4 is the mount option, which is usually fine with defaults

Column 5 sets whether to use dump backup, set 0 to no backup, and set 1 to 2 as backup, but the backup importance of 2 is less than 1.

Column 6 sets whether to use fsck to check the mounted disk when booting, 0 to not check, 1 to 2 for inspection, but 2 to check later than 1.

This article needs to mount the logical volume lv_study to / lvm_study, the file system is in ext4 format, and there is no dump backup or boot disk check.

/ dev/mapper/vg_study-lv_study / lvm_study ext4 defaults 00 after adding the above command to fstab, to avoid possible errors, we can use the mount-a command to verify that the editing is correct. After executing the mount-a command, check with df-h and you will find that the disk has been mounted successfully, indicating that there is no error in the input. The system can be mounted automatically the next time it restarts.

The example figure is as follows:

Note: (1) the root directory must take precedence over other mount points

(2) the mount point must be an existing directory

(3) when uninstalling, you must ensure that there is no read or write operation on the current disk.

two。 Modifying the / etc/rc.d/rc.local file and adding the mount command to the rc.local file is another way to automatically mount the boot.

Mount / dev/mapper/vg_study-lv_study / lvm_study

This is the end of the content of "how to set up automatic mounting of Linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: File backup inspection command disk system content time more format directory knowledge device error practical obvious important successful successful next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Technology macOS Huawei Shulou Tech Info