Perform FSCK on virtual server in Recovery Mode


Added: 03.08.2016 13:41:31     Last updated: 16.01.2017 22:15:48

In this guide we will go through how you can start the virtual server in «Recovery mode», and then run FSCK on the server's hard drive(s).

The guide only applies for Linux based virtual servers. Commands used are written like this: «command», where «» is not included when command is actually used.

Because of various reasons, a file system can become corrupt, and if that happens you will have problems using the server like normal. To fix this, you can run FSCK on the hard drive(s) that has a corrupt file system.

You start by rebooting the virtual server into what is called «Recovery mode». Basically, the server is rebooted with an operating system that is loaded to the memory on the server, and you can access the server via «console» in the control panel or via SSH towards the server's IP address. When the server is started in «recovery mode», the hard drives will not be «mounted», which means that we can perform advanced operations on it that usually would not be possible.

Step 1:

  1. Go to «Virtual servers»
  2. Choose the actual server.

Find virtual server in the menu in OnApp

Step 2:

  1. Click on the «Tools» menu
  2. Click on «Reboot in Recovery»

Restart virtual server in recovery mode

Click «Yes» to confirm that the server should be rebooted into «Recovery mode».

Confirm reboot of virtual server in OnApp

Step 3:

  1. When the server has been restarted in «Recovery» you will see this in the overview of the server.
  2. To gain access to the server you can either use «Console» or SSH. Because of the text design in console, we are using SSH in this example. The procedure is the same independently of how you connect to the server.

Recovery mode indicated on virtual server in OnApp

Step 4:

  1. When you log in to a server that has been started in "Recovery" you must use «root» as username, and the password that was set on the server originally.
  2. As mentioned in the introduction, the disks are not mounted in «Recovery», so to see this you write «fdisk -l»
  3. Which hard drive «fsck» should be run on can be indentified from the size. In this example we know that the hard drive is 5GB, and it is therefore disk «/dev/xvdb1» it's about.
  4. To run «fsck» on the disk, you write: «fdisk -y /dev/xvdb1». In our example there are no flaws in the hard drive, and therefore limited information is being given. In case there is a fault on the hard drive, both the progression in the process and what should be corrected will be visible on the screen.

Recovery mode using SSH

Step 5:
When you are done, you close «Console»/disconnect from SSH and restart the server.

After completion, restart the virtual server in OnApp

We have now seen how to fix a corrupt file system by using «FSCK».