All Products
Search
Document Center

:What do I do if a disk is not properly mounted on a Linux ECS instance?

Last Updated:Aug 02, 2024

This topic describes the cause of and solution to the issue that the Linux operating system of an Elastic Compute Service (ECS) instance cannot start when a disk is not properly mounted on the instance.

Problem description

A disk is not properly mounted on an instance that runs a Linux operating system. As a result, the Linux operating system of the instance cannot start.

Cause

You ran commands to mount disks on the Linux ECS instance, but you did not configure the disks to automatically mount in the /etc/fstab file or the automatic mounting configurations of the disks contain an error. As a result, an exception may occur when the operating system starts, which causes a startup failure.

Solution

  1. To prevent accidental operations from causing data security issues, create snapshots for disks attached to the Linux ECS instance.

    For more information, see Create a snapshot for a disk.

  2. Connect to the Linux ECS instance.

    For more information, see Connection method overview.

  3. Run the following command to mount disks:

    mount /dev/vdb1 /mnt
    Note

    In the preceding command, the dev/vdb1 partition is used. Replace dev/vdb1 with the actual device name.

  4. Run the following command to open the /etc/fstab configuration file.

    Note

    Before you modify the configuration file, run the cp /etc/fstab /etc/fstab.bak command to back up the file.

    vim /etc/fstab
  5. Press the I key to enter Insert mode and add the following configuration to the end of the file:

    /<Disk partition> /<Mount directory> <File format> defaults 0 0

    Sample command: /dev/vdb1 /mnt ext4 defaults 0 0. Modify the configuration based on your actual environment.

    Note
    • Replace the <Disk partition> variable with the actual disk partition. In this example, the /dev/vdb1 partition is used.

    • Replace the <Mount directory> variable with the actual mount directory. In this example, the /mnt directory is used.

    • Replace the <File format> variable with the actual file format. In this example, the ext4 format is used.

    A command output similar to the following one is displayed. {C07A7139-765E-4586-B620-138E858DE529}_20200720105328.jpg

  6. Press the Esc key to exit Insert mode, enter :wq, and then press the Enter key to save and close the file.

References