Introduction
This article describes how to check and repair the file systems of Linux instances.
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.
This topic uses /dev/vdb1
as an example to describe how to check and repair a file system.
Create a snapshot for all enabled indexes
First, you must create a snapshot for the instance disk to improve its fault tolerance capability. For more information about how to create a snapshot, see create normal snapshots.
Check and repair the file system
- Log on to a Linux instance:
- Data disk file system problem: see ECS connection overview.
- The system disk file system issues: you can see uninstalling Linux instance of system disk and mount them to other ECS instances as a data disk method of Step II and step three, system disk is attached to a different instance become for the data disk and then log on to the instance do the following.
Note: When you perform step 3, you only need to perform the first three small steps in step 3. That is, you do not need to mount the file system.
- Run the following command to verify that the file system is not mounted to the system:
df -h
Note: if a file system is attached to the system, you can run the
umount/dev/vdb1
command at the appropriate business time to unmount the file system. - Run the
blkid
command to view the file system type. You can perform the following operations to check and repair different file system types:
- For EXT3 and EXT4 file systems:
fsck-y/dev/vdb1
- For XFS file systems:
xfs_repair/dev/vdb1
- For EXT3 and EXT4 file systems:
- If the issue is fixed, skip this step. If you have a system disk file system problem, you need to attach the disk to the original instance. For more information, see step 5 of detaching a system disk from a Linux instance and attaching the system disk to another ECS instance as a data disk.
- Run the following command to mount the file system:
mount /dev/vdb1 /mnt
- If you run the following command again to check the mounted file system, the message the file system is abnormal still occur, and you can ignore related alerts. For more information, see Redhatissue.
- For EXT3 and EXT4 file systems:
fsck-y/dev/vdb1
- For XFS file systems:
xfs_repair/dev/vdb1
- For EXT3 and EXT4 file systems:
Application scope
- Elastic Compute Service