The file system check is a practical tool if an error occurs in your file system and your server is not booting anymore. With this tool, you can analyze and repair such errors in your file system. We recommend backup all your data before you start with this operation because there could be data loss of your server during the repair process. Please start the file system check in the rescue system.

If you do not know what the rescue system is or how to start it, please click here.

As soon as your server has booted into the rescue system, please use the following command to display all existing partitions.

  • fdisk -l

In this example, the system partition is located on /dev/vda1. Normally the system partition is located on /dev/sda2 or /dev/vda1.

Please use the following command to check which file system type is used.

INFORMATION: Please use your actual partition, in our case we have to use /dev/vda1

  • blkid | grep vda1 | awk '{print $3}'

Depending on which file system is used and which partition has to be checked, you have to use the following commands. This is only a check in advance and your file system will not be repaired.

  • fsck.ext2 -n /dev/vda1 = For the file system ext2
  • fsck.ext3 -n /dev/vda1 = For the file system ext3
  • fsck.ext4 -n /dev/vda1 = For the file system ext4
  • fsck.btrfs -n /dev/vda1 = For the file system btrfs
  • and so on...

In our case we are using the file system ext4, therefore, we have to use the following command. Please use the command with the right file system type for the rest of the following commands.

  • fsck.ext4 -n /dev/vda1

You will get as a result the errors of your file system. If you would like to repair scattered errors, so use the following command.

  • fsck.ext4 /dev/vda1

If you think that all errors have to be repaired, please use the following command. This command includes the parameter  -y which answers all queries with  "Yes". It is not necessary to answer them manually.

Important: We recommend using this command only if you are 100 percent sure.  All queries will be accepted without further notification.

  • fsck.ext4 -y /dev/vda1

Your system should start normally once the file system check has been finished.

If you would like to exit the rescue system and boot from the regular hard drive, please use the following command.

  • reboot

Your server should start the operating system now.

Additional important information:

If you start a file system check, some files might lose information about their names and locations in the file system. The file system checks and deposits these files in a specific directory called lost+found. If there are missing files after you have performed the file system check, you will be able to find the files in this directory in most cases.

Was this answer helpful? 0 Users Found This Useful (0 Votes)