How do I disable automatic mounting on startup in Linux?

To disable the automatic mounting of the Linux system at startup, you can follow these steps:

  1. Open the terminal and login to the system as an administrator.
  2. Open the /etc/fstab file with a text editor like vi or nano, which records the devices that need to be mounted when the system starts up.
  3. Please open the file /etc/fstab using the command “sudo vi”.
  4. Locate the corresponding line in the file that needs to be unmounted automatically. Typically, these lines contain the UUID or device name (e.g. /dev/sda1) of the device.
  5. Add a hashtag (#) at the beginning of these lines to comment them out. This way, the system will not automatically mount these devices at startup.
  6. For example, to replace the original line:
  7. Use the unique identifier xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to mount /mnt/xxx with the ext4 file system using default settings.
  8. Change to: Make adjustments to
  9. # Universally Unique Identifier (UUID) = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, mounted at /mnt/xxx with ext4 file system, default settings, and options 0 and 2.
  10. Save and close the file.
  11. Restart the computer to apply the changes.

After completing the above steps, the canceled automatic mounting will take effect upon the next system startup.

bannerAds