国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Computer Tutorials Computer Knowledge Automount drives on Linux

Automount drives on Linux

Mar 20, 2024 am 11:30 AM
linux automatic driver Linux operating system

Automount drives on Linux

If you are using a Linux operating system and want the system to automatically mount the drive at boot, you can do this by adding the device's unique identifier (UID) and mount point path to the fstab configuration file to achieve. fstab is a file system table file located in the /etc directory. It contains information about the file systems that need to be mounted when the system starts. By editing the fstab file, you can ensure that the required drives are loaded correctly every time the system starts, thus ensuring stable system operation.

Automatic driver installation can be easily applied to a variety of situations. For example, I plan to back up my system to an external storage device. To achieve automation, ensure that the device remains connected to the system, even at startup.

Similarly, many applications will synchronize files directly to the system drive. If the drive is unmounted, resynchronizing these files will cause great inconvenience. The autoload feature automatically identifies and loads the drive without requiring the user to manually run a load command or execute it manually through a graphical interface.

In this tutorial, I will explore how to make additional drives mount automatically on boot in Linux.

Automounting drives on Linux

Automatically mounting an attached drive on Linux requires careful steps.

Normally, Linux will not automatically mount any connected drive when booting, but will need to be manually mounted to a specified mount point to access the data. However, some Linux distributions with desktop environments automatically mount the drive for users, allowing users to quickly access data.

NOTE: The instructions given in this guide were performed on Ubuntu 22.04. However, the given command does not give any errors on other distributions either.

1. Find UID and file system type

To get the name, unique identification number (UUID) and file system type of the drive, there are two ways to do it. The first is to use the system's built-in graphical user interface application to search, and the other method is to achieve it through the command line.

I personally prefer doing it in the terminal because it's more accurate.

Sudo Blakid

The blkid command is a command line utility used to obtain information about internal and external block devices.

Now, identify the label of the drive, in my case MyDrive, and note the UUID and file system type. Don’t forget to give your storage drive a name as it will be easily identifiable.

The command output screenshot shows all the required information.

  • UID = 65B1—FB17
  • File system type = exfat

UID (Universally Unique Identifier) ??is the ID of the block device MyDrive (/dev/sda1), and the file system type is exfat.

Please note that the UID can have a different number of characters depending on the file system type. For example, the FAT file system UICC has 8 alphanumeric characters with a dash (-), NTFS has 16 character strings, and EXT has 32 alphanumeric characters with a dash.

Now, let's do this on the GUI, since I'm using Ubuntu 22.04 and its Genome desktop environment has a default disk management application called Disks. Open the app and tap on the drive you can identify by storage capacity.

2. Create a mount point

To permanently mount an external drive to Linux, a mount point needs to be created. This is a one-time setting unless you choose a different mount point in the future.

The mount point is where the file system to be accessed is placed. It can be any directory anywhere on Linux; typically the /mnt or /media directories are used. I'm creating a directory called /media/MyBackup in the root directory that will be my mount point.

sudo mkdir/media/MyBackup

Now, I will permanently mount my external drive MyDrive to the /media/MyBackup mount point.

We have found the name, UUID and file system type of the connected drive and we have also created the mount point. The final step is to access and modify the fstab file.

3. Access and edit fstab files

The Fstab file is a file system configuration file in the /etc directory that contains information about mounted storage devices. It can be accessed in any text editor, but requires superuser access to modify.

Sudo vim/etc/fstab

Now, it’s time to insert the information extracted above using the following common syntax.

[Device][Mount Point][File System Type][Mount Options][Dump][Pass]

All parameters of the above syntax will be explained below.

[equipment] DeviceUUID
[Installation point] The mount point directory from which to access the contents of the attached drive [more information about running the man mount command]
[File system type] File system format type, such as fat, exfat, ntfs or ext4
[Load-options] Read and write options for the device (default is for read and write access)
[Dump] Enable or disable backup of connected devices; if 0, backup is disabled

The fsck command is used to verify the drive for errors before initiating boot. For root devices, fsck will always be 1.

The following format is suitable for most Linux distributions, such as Arch Linux or Debian; however, the latest Ubuntu (22.04) has a different format, which is mentioned below.

UID = [UUID of device][Mount point][File system type][Mount options][Dump][Pass]

I will insert the above extracted information into the fstab file using the above format.

UID = 65B1—F446/Media/MyBackup exfat default value 0 0

Note: Use tabs instead of spaces to separate fields.

I have set [Installation Options] to default, which means the device has read and write access. The [Dump] and [Pass] options are set to 0 because I don't want to backup and do an fsck check on boot.

Ubuntu format

The latest Ubuntu (22.04) formats external drives differently in the fstab file.

/dev/disk/by—uuid/[UUID of device][mount point][file system type][mount options][dump][pass]

Because I am using Ubuntu 22.04, I will use this method.

/dev/disk/by—uuid/65B1—F446/media/MyBackup exfat default value 0 0

Now, save and exit the file; I'm using Vim, and the :wq command will write and exit the editor.

4.Verification

To verify that all the information mentioned in the fstab file is correct, use the mount-a command.

Sudo Mountain

If there are any errors, the above command will display them, otherwise, there will be no output.

No errors were encountered, which means the drive was mounted successfully.

The fstab files of various Linux distributions are given below for comparison.

Debian/etc/fstab file

Arch Linux/etc/fstab file

Ubuntu/etc/fstab file

in conclusion

If you use the drive in your daily work. Especially when you want to save files in it or access files from it to your Linux system. Alternatively, if you are interested in backing up your system and don't want to restore it after booting, this is a great way to automate this.

Automount is a method of mounting a storage drive at boot time, since many Linux distributions do not mount the drive at boot time. This can be done by placing the device's UID and mount point in the /etc/fstab file.

The above is the detailed content of Automount drives on Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Postman Integrated Application on CentOS Postman Integrated Application on CentOS May 19, 2025 pm 08:00 PM

Integrating Postman applications on CentOS can be achieved through a variety of methods. The following are the detailed steps and suggestions: Install Postman by downloading the installation package to download Postman's Linux version installation package: Visit Postman's official website and select the version suitable for Linux to download. Unzip the installation package: Use the following command to unzip the installation package to the specified directory, for example /opt: sudotar-xzfpostman-linux-x64-xx.xx.xx.tar.gz-C/opt Please note that "postman-linux-x64-xx.xx.xx.tar.gz" is replaced by the file name you actually downloaded. Create symbols

How to manually install plugin packages in VSCode How to manually install plugin packages in VSCode May 15, 2025 pm 09:33 PM

The steps to manually install the plug-in package in VSCode are: 1. Download the .vsix file of the plug-in; 2. Open VSCode and press Ctrl Shift P (Windows/Linux) or Cmd Shift P (Mac) to call up the command panel; 3. Enter and select Extensions:InstallfromVSIX..., then select .vsix file and install. Manually installing plug-ins provides a flexible way to install, especially when the network is restricted or the plug-in market is unavailable, but attention needs to be paid to file security and possible dependencies.

Detailed introduction to each directory of Linux and each directory (reprinted) Detailed introduction to each directory of Linux and each directory (reprinted) May 22, 2025 pm 07:54 PM

[Common Directory Description] Directory/bin stores binary executable files (ls, cat, mkdir, etc.), and common commands are generally here. /etc stores system management and configuration files/home stores all user files. The root directory of the user's home directory is the basis of the user's home directory. For example, the home directory of the user user is /home/user. You can use ~user to represent /usr to store system applications. The more important directory /usr/local Local system administrator software installation directory (install system-level applications). This is the largest directory, and almost all the applications and files to be used are in this directory. /usr/x11r6?Directory for storing x?window/usr/bin?Many

Where is the pycharm interpreter? Where is the pycharm interpreter? May 23, 2025 pm 10:09 PM

Setting the location of the interpreter in PyCharm can be achieved through the following steps: 1. Open PyCharm, click the "File" menu, and select "Settings" or "Preferences". 2. Find and click "Project:[Your Project Name]" and select "PythonInterpreter". 3. Click "AddInterpreter", select "SystemInterpreter", browse to the Python installation directory, select the Python executable file, and click "OK". When setting up the interpreter, you need to pay attention to path correctness, version compatibility and the use of the virtual environment to ensure the smooth operation of the project.

The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java May 20, 2025 pm 08:21 PM

The main difference between Java and other programming languages ??is its cross-platform feature of "writing at once, running everywhere". 1. The syntax of Java is close to C, but it removes pointer operations that are prone to errors, making it suitable for large enterprise applications. 2. Compared with Python, Java has more advantages in performance and large-scale data processing. The cross-platform advantage of Java stems from the Java virtual machine (JVM), which can run the same bytecode on different platforms, simplifying development and deployment, but be careful to avoid using platform-specific APIs to maintain cross-platformity.

After installing Nginx, the configuration file path and initial settings After installing Nginx, the configuration file path and initial settings May 16, 2025 pm 10:54 PM

Understanding Nginx's configuration file path and initial settings is very important because it is the first step in optimizing and managing a web server. 1) The configuration file path is usually /etc/nginx/nginx.conf. The syntax can be found and tested using the nginx-t command. 2) The initial settings include global settings (such as user, worker_processes) and HTTP settings (such as include, log_format). These settings allow customization and extension according to requirements. Incorrect configuration may lead to performance issues and security vulnerabilities.

MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step May 23, 2025 am 06:09 AM

The installation and configuration of MySQL can be completed through the following steps: 1. Download the installation package suitable for the operating system from the official website. 2. Run the installer, select the "Developer Default" option and set the root user password. 3. After installation, configure environment variables to ensure that the bin directory of MySQL is in PATH. 4. When creating a user, follow the principle of minimum permissions and set a strong password. 5. Adjust the innodb_buffer_pool_size and max_connections parameters when optimizing performance. 6. Back up the database regularly and optimize query statements to improve performance.

Comparison between Informix and MySQL on Linux Comparison between Informix and MySQL on Linux May 29, 2025 pm 11:21 PM

Informix and MySQL are both popular relational database management systems. They perform well in Linux environments and are widely used. The following is a comparison and analysis of the two on the Linux platform: Installing and configuring Informix: Deploying Informix on Linux requires downloading the corresponding installation files, and then completing the installation and configuration process according to the official documentation. MySQL: The installation process of MySQL is relatively simple, and can be easily installed through system package management tools (such as apt or yum), and there are a large number of tutorials and community support on the network for reference. Performance Informix: Informix has excellent performance and

See all articles