How do you add a mount point in CentOS 7?

In CentOS 7, you can add a mount point by following these steps:

  1. Make sure that the device you want to mount is properly connected to the server. You can use the command lsblk to view information about the connected devices.
  2. Create a directory to serve as a mounting point. You can choose to create a new directory under the /mnt directory, such as /mnt/mydevice, as the mounting point.
sudo mkdir /mnt/mydevice
  1. Find the file system identifier of the device to be mounted. You can use the commands lsblk or blkid to view the file system identifier of the device. Typically, the identifier of the device is similar to /dev/sdXn (where X is the device letter, and n is the partition number).
  2. Open the /etc/fstab file for editing in order to automatically mount devices at system startup. Use a text editor to open the file.
sudo vi /etc/fstab
  1. Add a new mount point entry at the bottom of the file. The format is as follows:
<设备标识符> <挂载点> <文件系统类型> <挂载选项> <备份选项> 0 0
  1. Device Identifier: The file system identifier for the device to be mounted.
  2. : The directory path created previously used for mounting devices.
  3. : The type of file system on the device, such as ext4, ntfs.
  4. “Mount options: used to specify the mount options for the device, such as defaults or noauto.”
  5. : Used to specify the backup options, typically set to 0.
  1. Save and close the /etc/fstab file.
  2. Mount the device to the specified mounting point using the following command:
sudo mount -a

After completing the above steps, the device will automatically mount to the specified mount point during system startup.

bannerAds