"Linux Learning is Not Difficult" File System Management (8): Setting Up Automatic Mounting of Linux File System at Boot

18.8  " Linux Learning Is Not Difficult" File System Management ( 8 ): Set up to automatically mount the Linux file system at boot

It can only be used after a certain partition or device is mounted, but when the computer is restarted, it needs to be mounted again. At this time, the Linux file system can be automatically mounted on boot by modifying the /etc/fstab file. To automatically mount the file system at startup, you need to add information about the disk partition to the /etc/fstab file, which can be achieved by providing the device name and UUID.

1 . use device name

Edit the /etc/fstab file and add the following at the end of the file.

/dev/sda5            /mnt/www          xfs       defaults       1 2

2 . Using UUIDs

First use the following command to view the UUID information of the disk partition /dev/sda5.

[root@rhel ~]# ls -l /dev/disk/by-uuid

Total usage 0

lrwxrwxrwx. 1 root root 10 12月 26 14:56 500f998a-a4c9-43d8-b468-109a42787ec8 -> ../../sda2

lrwxrwxrwx. 1 root root 10 12月 26 14:56 b6d87c93-6c54-48f3-9295-ec0f7b92c9f3 -> ../../sda1

lrwxrwxrwx. 1 root root 10 12 26 14:56 d8636446-9878-4437-b43c-50d71af8beba -> ../../sda3

lrwxrwxrwx. 1 root root 10 12 26 15:02 f084b8a6-c9ab-425b-99da-b64cb35e4fc2 -> ../../sda5

// The UUID of disk partition /dev/sda5 is f084b8a6-c9ab-425b-99da-b64cb35e4fc2

Then edit the /etc/fstab file and add the following at the end of the file.

UUID= f084b8a6-c9ab-425b-99da-b64cb35e4fc2     /mnt/www     xfs   defaults    1 2

 

 

This article is excerpted from " Learning Linux is not difficult"Teaching material, this is a most practical Linux introductory teaching material with equal emphasis on theory and practice. To read the entire book, please visit Linux Operators ( www.linuxywz.com) website .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324878850&siteId=291194637