All Products
Search
Document Center

:How do I remove a block device that does not exist in the /etc/fstab file of a Linux instance?

Last Updated:Aug 06, 2024

If other block devices are available on a Linux instance, the system may fail to after restarting the system. This article describes how to remove block devices that do not exist in the /etc/fstab file of a Linux instance.

Procedure

To avoid data security risks caused by misoperations, create a snapshot of the system disk of a Linux instance. For more information about how to create a snapshot, see Create a snapshot for a disk.

  1. Log on to a Linux instance through VNC. For more information, see Connection method overview.

    Note

    If your ECS instance cannot be started because of an exception related to the/etc/fstab file, fix the exception on System startup exceptions caused by incorrect configuration of the /etc/fstab file of a Linux instance.

  2. Run the following command to view block information in the current Linux instance.

    blkid

    A similar output is displayed, indicating that the Linux instance has two block devices. {35774C7A-F883-4C76-BFBA-1DA5F2D06AE7}_20200715150857.jpg

    Note

    This is only an example. Follow the actual situation on site when performing the operation.

  3. Run the following command to view the information about block devices configured in the current /etc/fstab file.

    cat /etc/fstab

    Check whether the /etc/fstab file and the block device information in the blkid command result are inconsistent, that is, whether the UUID information is completely consistent. The command output is as follows: {C491E039-3947-483C-BB44-0BAF49EC58AC}_20200715170703.jpg

  4. If there are inconsistencies, record the results of the blkid command. Then execute the following command to edit the /etc/fstab file.

    vim /etc/fstab
    Note

    Before modifying a file, back up the /etc/fstab file.

    Click A key to delete the block device information in the /etc/fstab file that is inconsistent with the result of the blkid command. After the update is complete, click Esc to exit the edit mode. Enter :wq, type Enter, save and exit.

    Note
    • The colon (:) in :wq needs to be output by clicking Shift plus the colon (:) key.

    • It is recommended to replace the delete operation with an annotation symbol (#).

    A similar output is displayed, including a block device whose UUID is unique. The site conditions are as follows.{86010956-178E-4A17-8DA2-7C8727964BB4}_20200715114324.jpg

  5. Check whether the block device information in the /etc/fstab file is consistent with the information displayed in the blkid command.