How to automatically mount a hard drive at startup in Linux?

In Linux systems, you can achieve automatic mounting of hard drives at startup by modifying the /etc/fstab file.

First, use the command sudo fdisk -l to view the device name and partition information of the hard drive, locate the hard drive and its corresponding partition that needs to be mounted.

Next, open the /etc/fstab file and you can edit it using the command sudo nano /etc/fstab.

Add a line in the file specifying the device name, mount point, file system type, and mount options for the hard drive to be mounted.

For example, if the disk device name is /dev/sdb1, the mount point is /mnt/data, the file system type is ext4, and the mount option is default, you can add the following content to the /etc/fstab file:

/dev/sdb1   /mnt/data   ext4   defaults   0   0

After saving the file, restart the system, and the hard drive will automatically be mounted to the specified mount point.

Please be careful when editing the /etc/fstab file as any errors could prevent the system from starting up. It is recommended to back up the file before making any changes.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds