You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Instance unable to start issue
Repair solution for corrupted file systems of Linux instances
Copy page
Download PDF
Repair solution for corrupted file systems of Linux instances
This topic describes how to repair corrupted file systems of a Linux instance, with /dev/vdb used as an example.​
Prerequisites​
We recommend creating a snapshot first to back up instance data. This improves your fault tolerance and ensures data security.​
Procedure​
  1. Log in to the target instance. For operation details, refer to Logging in to Linux instances.​
  1. Execute the following command to confirm whether a file system is mounted on the instance.​
  • ​
    df -h​
    ​
  1. (Optional) If a file system is mounted, execute the following command to unmount it.​
  • ​
    umount /dev/vdb​
    ​
  1. Execute the following command to view the file system type of the target partition or storage device.​
  • ​
    blkid​
    ​
  • Sample output:​
  • ​​​
  1. Execute commands to check and repair the file system based on the file system type.​
  • ​
    EXT3/EXT4 file system
    XFS file system
    VFAT/FAT32 file system
    ​
    1. Execute the following command to check whether an error exists in the file system.​
    • ​
      sudo fsck -n /dev/vdb​
      ​
    tip​
    If the output contains an error about The super block Cloud no be read or does not describe a correct ext2 filesystem when you check for file system errors, skip to Step 3 for repair.​
    1. If an error exists in the file system, execute the following command to repair it.​
    • ​
      sudo fsck -y /dev/vdb​
      ​
    1. If the superblock is corrupted, follow the steps below to repair it.​
    1. Execute the following command to obtain backup superblock numbers.​
    • ​
      sudo mke2fs -n /dev/vdb​
      ​
    • If the following output is displayed, it indicates that the backup superblock numbers for /dev/vdb are 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, and 4096000.​
    • ​​​
    • When you cannot obtain the backup superblock numbers using the command, perform the following steps to obtain common backup superblock numbers.​
    1. Execute the following command to obtain the block size.​
    • ​
      sudo blockdev --getbsz /dev/vdb​
      ​
    • When the following output is displayed, it indicates that the block size of /dev/vdb is 4096 bytes:​
    • ​​​
    1. Refer to the following table to obtain the common backup superblock numbers corresponding to the block size.​
    • ​
      Block size (bytes)​
      Common backup superblock numbers​
      1,024​
      8193, 24577, 40961...​
      2,048​
      16384, 49152, 81920...​
      4096​
      32768, 98304, 163840, 229376...​
      8192​
      65536, 196608, 327680...​
      ​
    1. Execute the following command to repair the superblock using a backup superblock.​
    • ​
      sudo e2fsck -b 32768 /dev/vdb​
      ​
    tip​
    • Replace 32768 with the actual backup superblock number. If the first backup superblock number is invalid, you can try other backup blocks in order.​
    • Replace /dev/vdb with the actual disk name rather than the partition name.​
    ​
  1. After the repair is completed, execute the following command to restart the instance.​
  • ​
    reboot​
    ​
  1. (Optional) If the target volume is a system volume, mount the file system. If the target volume is a data volume, skip this step.​
  1. Execute the following command to mount a file system.​
  • ​
    mount /dev/vdb /mnt​
    ​
tip​
Replace /mnt with the actual mount point.​
  1. Execute the corresponding command again to check the mounted file system.​
  • For XFS file system: xfs_repair /dev/vdb​
  • For EXT3 and EXT4 file systems: fsck -y /dev/vdb​
  • Here, fsck -y /dev/vdb is used as an example. Output similar to the following information indicates that the repair succeeds.​
  • ​​​
Last updated: 2026.06.18 17:49:51