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: Jul 15, 2021

Disclaimer: this article may be contributed by the community or involve third-party product information, we recommend that you visit the community or the official website of third-party products for help and support. Third-party products will not be provided by Alibaba Cloud after-sales support. This document is for reference only. Alibaba Cloud makes no guarantee by express or any other means.

Introduction

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.

Background

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.

Perform the following steps:

  1. 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 normal snapshots.
  2. Log on to a Linux instance through SSH or VNC. For more information, see connection methods overview introduction.
    Note: if your ECS instance cannot be started because of an exception related to the /etc/fstab file, fix the exception caused by incorrect configuration of the /etc/fstab file on Linux instances.
  3. 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.
  4. 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
  5. 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
  6. Check whether the block device information in the /etc/fstab file is consistent with the information displayed in the blkid command.

Application scope

  • Elastic Compute Service